I want to know if there is anyway that I can send sms to multiple number of people using the SmsManager. I know that I can run a loop through the contacts and send sms individually but I figured that there may be a way to do this.
The code I use is given below:
SmsManager.getDefault().sendTextMessage("PHONE_NOS", null,msg.getText().toString(), sentPI, deliveredPI);
PS: I have tried using ";" as a separator. But the only thing that happens is that it sends an sms only to the first person in the list.
For the benefit of people who are seeing this late, its not possible to send SMS to multiple people. As Bill Mote has pointed out, if there was such a thing possible, there would have been an API which would have taken a "List-of-numbers" as an argument. So the only possible solution is to have an iterator for the numbers and send them one at a time.
This may helpful for you.
Add this line in AndroidManifest.xml
The net-net-net here is it cannot be done without iterating through a loop and sending 1 message to 1 addressee.
I spent 1/2 a Saturday trying to do this very thing. I could not make it work with ";", ",", " ", or "\n". I should have tried hard-coding 2 addressees separated by all the delimiters first, but I did learn a valuable lesson about the Android SDK: if they wanted you to send to more than 1 addressee at a time then they'd accept an ArrayList or an array of Strings rather than a singular String ;)