8

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.
Lucifer
  • 29,392
  • 25
  • 90
  • 143
user3173888
  • 95
  • 1
  • 4

1 Answers1

6

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.

Community
  • 1
  • 1
Lucifer
  • 29,392
  • 25
  • 90
  • 143