Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending bulk sms using sms manager in android

Tags:

android

sms

I am sending sms nearly to 90-100 number's using SmsManager, I am reading number's from file and passing the number to sendtextmessage function as below

String[] nos;// this array contains mobile nos
SmsManager sm = Smsmanager.getDefault();
for(int i=0;i<nos.length;i++){
 sm.sendtextmessage(nos[i],null,"hello",null,null);
}

problem is:

  1. Code is executing but messages are not sending, even I am having balance
  2. I changed code to use stock sms app to send even this also failed to send.
  3. if I send one to one no from stock app, it is sending but if I choose number more than 5 then it is not sending I used htc explorer.
like image 664
user3173888 Avatar asked Jan 08 '14 15:01

user3173888


1 Answers

Your code is right but the problem is that you are firing SMS in a for loop. The for loop is going to execute very fast while Sms Sending action requires some delay before sending a next SMS.

Previously I have done same kind of program in Java, you may find it's working code in my other answer. So during my development I come to know that SMS sending activity requires a time gap before sending next SMS. So I would like to suggest you to have a delay of atleast a 1000 micro second before sending the next SMS.

like image 94
Lucifer Avatar answered Oct 31 '22 10:10

Lucifer