sms PhoneEvent

pobss

Member
Licensed User
Longtime User
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
hi,
Why this code sms sent status end sms delivered not work?
thanks
 

kalarius

Active Member
Licensed User
Longtime User
I can not answer for your code but at my program Iuse the follow

at global variable

Dim mySms As PhoneSms
Dim PE As PhoneEvents

at the activity

Pe=intialize("Pe")

and when I want to sent an sms I use
mySms.Send(Telnumber,Message)

this eraise the event

Sub pe_SmsSentStatus (Success As Boolean, ErrorMessage As String, PhoneNumber As String, Intent As Intent)

If Success=False Then
Msgbox("sms not sent " & errorMessage)
else
msgbox("Sms ok")
End If
end sub
 
Upvote 0

pobss

Member
Licensed User
Longtime User
kalarius thanks, I can not use phonesms otherwise my phone operator after each sms sent sends an sms confirmation payme.
so I have to use the code Erel but smssentstatus does not work.
 
Upvote 0
Top