0

I've made a small app from where user can send SMS to many users at the same time. I've done it like it is done i all tutorials and it's working fine. I create a SMSManager, divide a message and send it as a multipart:

ArrayList<String> msgArray=smsManager.divideMessage(msg);
smsManager.sendMultipartTextMessage(phoneNo, null, msgArray, null, null);

Everything works fine. The problem is if user wants to send more than 30 messages in a couple of minutes. In that case Android displays a warning:

"{MyAppName} is sending to many messages. Do you want to allow sending messages?"

For each messages above 30 sent messages, I receive that warning. It gives me an option to allow or to deny. The problem is that even if I click 'allow', messages don't get sent.

Imagine a situation where user chooses 35 contacts and want to send a message to all of them. After he clicks send, 30 messages are sent and for other 5 that dialog is displayed where user is asked does he want to allow further sending.

Even if I click 'allow', message doesn't get sent and only 30 messages are sent. This way user gets an impression that all messages are sent but they are not. Those 5 messages are not sent even if he allowed app to send them.

Is there a workaround for this problem? I need some workaround to find out which messages are not sent and the way to send them.

Thank you.

user4386126
  • 1,205
  • 5
  • 17
  • 32

1 Answers1

0

You shouldn't set null on ArrayList sentIntents argument but add actual array of PendingIntent - you can use that to check if your message was sended correctly. Take a look at documentation.

Probably answer to this question also will be helpful.

Community
  • 1
  • 1
pstrag
  • 617
  • 5
  • 16
  • Thank you but there is a problem that none of those error messages work for this case. Generic failure, no service, null pdu and radio off are not triggered when that alert dialog shows. – user4386126 Feb 06 '15 at 15:57
  • so the result you receive in BroadcastReceiver is Activity.RESULT_OK? – pstrag Feb 06 '15 at 16:04
  • For first 30 messages I receive Activity.RESULT_OK but for other ones I don't receive any result. I have a feeling Google has some hidden result code which they use only internally. – user4386126 Feb 06 '15 at 18:54
  • I'm not sure but I think you can in this case file android bug report because it looks like bug for me: https://source.android.com/source/report-bugs.html – pstrag Feb 12 '15 at 09:31
  • Hmmm...but wait, Activity.RESULT_OK for 30 messages is quite OK - you can inform user 5 other messages wasn't send and ask if he want to send it again. – pstrag Feb 12 '15 at 09:34