Home » Android » android – Send SMS to multiple recipients via Intent

android – Send SMS to multiple recipients via Intent

Posted by: admin June 15, 2020 Leave a comment

Questions:

Hey Guys I’m trying to send SMS to multiple recipients viaINTENT..
I tried following to do it..

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", etmessage.getText().toString());
intent.setData(Uri.parse("smsto:" + returnedItems));
intent.setType("vnd.android-dir/mms-sms");
mcontext.startActivity(intent);

Where returnedItems is of Contact Numbers

But the Problem is that My recipients numbers are not setting on TO section on SMS INTENT where TEXT is displayed on TEXT section

How to&Answers:

Make sure that the numbers are seperated by ; .

Intent smsIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:1234456;234567"));
smsIntent.putExtra("sms_body", etmessage.getText().toString());
startActivity(smsIntent);

always works for me!

Answer:

Did you tried below ?

Intent mIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:999999;888888"));

I also found out “;” is not working in Samsung device. You have to add “,” instead of “;” for samsungs devices.

Intent mIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:999999,888888"));

Also check this answer

Answer:

Intent smsIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:" + pointsList));
smsIntent.putExtra("sms_body", "Hi Friends & Families, My Location is feeling unsafe in this location");
startActivity(smsIntent);

pointsList is something like ArrayList, for example [8777675673,8566463454,7776666664].
It is working fine.

Answer:

I have solved this by the following way.

Intent intent = new Intent(Intent.ACTION_SEND);
String numbers = "1234567890;9876543210;453678920"
intent.putExtra("address", numbers);
context.startActivity(Intent.createChooser(intent, context.getString(R.string.share_image)));

The numbers are separated by semi-colon (;). I read in some mobile phones the numbers need to separated by comma (,).

Hope this will help.