Android Question Send SMS

sultan87

Active Member
Licensed User
Longtime User
Good evening
I use

Dim sms As PhoneSms
Sms.Send2 ("33xxxxxxxxx", "therm", True, True)

I would like to await the return status SmsSentStatus to analyze it before continuing the program lines.
how to do ?

Best regards
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
You have posted in the wrong section. You would better had replies in : Android Questions.https://b4x.com/android/forum/forums/android-questions.26/

In fact, what you want to achieve is made in the program flow.
If you separate the subs correctly you can check if the SmsDelivered event (PhoneEvents) has fired and if it was the last message to send. Then in the same event when the condition was met, call another sub and so on.
 
Last edited:
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Good evening
I use

Dim sms As PhoneSms
Sms.Send2 ("33xxxxxxxxx", "therm", True, True)

I would like to await the return status SmsSentStatus to analyze it before continuing the program lines.
how to do ?

Best regards

sultanım aşağıdakini kullanabilirsin...;)

B4X:
Sub Process_Globals
Dim Psms As PhoneSms

Dim  PE As PhoneEvents
end sub

sub XXX_click
PE.Initialize("PE")
Psms.Send2("121344564","message",true,true)
end sub

Sub PE_SmsDelivered (PhoneNumber As String, Intent As Intent)
' this is deliveri status check
end sub

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

' this sendi,n complate status
end sub
 
Last edited:
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User

Attachments

  • sms_sample.zip
    31 KB · Views: 207
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
the current version of the Phone is 2.28.

you can send via intent if too.

B4X:
'ENVIAR SMS VIA INTENT
Sub Enviar_SMS(numero As String,texto As String)
    Try
        Dim In As Intent
        In.Initialize(In.ACTION_VIEW, "sms:" & numero)
        In.PutExtra("sms_body", texto)
        StartActivity(In)
    Catch
        Log(LastException)
    End Try
End Sub
 
Upvote 0
Top