When i sending the sms through Intent an exception comes android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO typ=vnd.android-dir/mms-sms (has extras) }
See my code below:-
try {
Intent sendIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:5551212;5551212"));
sendIntent.putExtra("sms_body", sendSMSStringOnCustomCheckIn());
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again later!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
I want to send the SMS to 2 phone nembers and both the phone numbers should be display in the recipient box of default SMS box.How can i do that?
I got the solution of my Question. In SAMSUNG devices i have to separate the phone numbers with ',' while other devices are accept the ';'.So unfortunately have to do this ugly vendor specific decision within your source code.
String separator = "; ";
if(android.os.Build.MANUFACTURER.equalsIgnoreCase("Samsung")){
separator = ", ";
}
Now my below code is working properly for SAMSUNG devices.
try {
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("address", "9971227563,9990900909");
sendIntent.putExtra("sms_body", sendSMSStringOnCustomCheckIn());
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again later!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With