Android Question Send SMS without delivery report

cmweb

Active Member
Licensed User
Longtime User
Hi,

as one of my users reported that he's been charged for delivery reports by his provider for every single SMS he sent through my app, I changed my code to this one as recommended in an older thread here:

B4X:
Sub SendSms(PhoneNumber As String, Text As String)
  Dim ps As PhoneSms
  Dim r As Reflector
  r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
  r.RunMethod4("sendTextMessage", Array As Object(PhoneNumber, Null, Text, Null, Null), _
      Array As String("java.lang.String", "java.lang.String", "java.lang.String", _
        "android.app.PendingIntent", "android.app.PendingIntent"))
End Sub

It seems to work fine.

But as my app needs to know if one SMS has been sent before it sends the next SMS I am using the PhoneState from PhoneEvents to get the SMS Sent status. But this seems to work any longer when sending through the new code above.

Am I right and is there a way to get the SMS Sent status?

Thanks,

Carsten
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Excuse me but have you tried with the PhoneSms ?
You could use SMS.send2(Number,text,true,false)
 
Upvote 0

cmweb

Active Member
Licensed User
Longtime User
Hi,

oh, well... I never noticed that SMS.send2() - I have been using SMS.send() and noticed the problem with the delivery report requests (these are charged by providers in several countries) and my search here in the forum only led me to the reflection code above...

Thanks a lot. Of course, SMS.send2() is the way to go. Works as expected.

Best regards,

Carsten
 
Upvote 0
Top