Send sms by opening default sms App it support both system and third party sms app programmatically in android.

try this:- 

public static void sendSMS(Context context, String mobileNo, 
       String msg) {
    Log.i("Send SMS", "");
    String defaultSmsPackage = Build.VERSION.SDK_INT >= 
            ? Telephony.Sms.getDefaultSmsPackage(context)

    Log.i("Send SMS", defaultSmsPackage);
    Uri uri = Uri.parse(String.format("smsto:%s", mobileNo));

    Intent smsIntent = new Intent(Intent.ACTION_SENDTO, uri);
    smsIntent.putExtra("sms_body", msg);

    try {
        Log.i("Finished sending SMS...", "");
    } catch (android.content.ActivityNotFoundException ex) {
                "SMS failed, There is no any default SMS App 
        Found.", Toast.LENGTH_SHORT).show();


Post a Comment

Popular posts from this blog

Lint found fatal errors while assembling a release target.

Windows 7 all Version 64-Bit iso file Download with crack activation. (Google Drive Link)

ViewModelProviders.of(this) is deprecated what to use instead ViewModelProviders.of(this) OR if you don't want to use ViewmodelFactory OR ViewModelProviders error.