0

I'm afraid this is a hard one. I have spent a long time searching and although I found many requests I didn't find a clear answer. I use SendTextMessage in a loop to send SMS messages to multiple recipients:

SmsManager.SendTextMessage(StringToJString(foo), nil, StringToJString(bar), nil, nil)

But some of the messages won't be sent and I suspect this happens because the sending of the previous message is not finished yet. I don't want to use a fixed delay. Instead I'm looking for a way to use the last two params (sentIntent & deliveryIntent) in order to know when a message has been sent (and when one has been delivered if possible). I read that i have to use 2 JIntents wrapped in 2 JPendingIntents but when it comes to creating a broadcast receiver (I think that's the way to go) I'm totally lost. Any help and a bit of sample code would be deeply appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
ion
  • 79
  • 2
  • 10
  • Yes, you need to add a broadcast receiver to your Android app in order to receive those `Intent` objects. There are online tutorials and third-party components available for adding broadcast receivers in XE5-XE7 projects, a simple Google search will find them. You will have to see if they still work in XE8. Embarcadero has still not implemented native broadcast receivers in FireMonkey itself. – Remy Lebeau Feb 17 '16 at 23:21
  • @RemyLebeau What should the OP search for? Can you point him/her to one or two examples? – David Feb 18 '16 at 00:35
  • Try searching for "delphi android broadcastreceiver", for starters. The first page of results has like half a dozen relevant hits. – Remy Lebeau Feb 18 '16 at 00:49
  • Already did all these, but I got lost. I think I will switch to Android Studio for this project. – ion Feb 18 '16 at 14:31

0 Answers0