Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send SMS to multiple recipients via Intent

I am trying to send SMS to multiple recipients viaINTENT. I tried the 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.

like image 607
qwerty Avatar asked May 05 '14 07:05

qwerty


People also ask

How to send text message using Android studio?

icon from the toolbar. Before starting your application, Android studio installer will display following window to select an option where you want to run your Android application. Now you can enter a desired mobile number and a text message to be sent on that number. Finally click on Send SMS button to send your SMS.


2 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!

like image 65
Swayam Avatar answered Oct 04 '22 20:10

Swayam


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

like image 42
Niranj Patel Avatar answered Oct 04 '22 19:10

Niranj Patel