Sending SMS using the intent of multiple phone numbers

When I send sms via Intent, an android.content.ActivityNotFoundException exception is thrown : no action was detected for working with Intent {act = android.intent.action.SENDTO typ = vnd.android-dir / mms-sms (has additional functions)}

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 SMS to 2 phone numbers, and both phone numbers should be displayed in the default recipient field for SMS message. How can i do this?

+2
source share
1 answer

. SAMSUNG ',', ';'. , , .

 String separator = "; ";


 if(android.os.Build.MANUFACTURER.equalsIgnoreCase("Samsung")){
    separator = ", ";
  }

SAMSUNG.

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();
            }
+8

Source: https://habr.com/ru/post/1539239/


All Articles