Android Question send an SMS and wait a return

sultan87

Active Member
Licensed User
Longtime User
hello,
I send an SMS to a phone number with a content control (Sms.Send2("07xxxxxx","FUN?",True,True))
I wait a return
if the phone number (07xxxxxx) or/and the command (FUN?) is incorrect, I did not back
how to test
best regards
 

sultan87

Active Member
Licensed User
Longtime User
hello,
I send an SMS to a phone number with a content control (Sms.Send2("07xxxxxx","FUN?",True,True))
I wait a return
if the phone number (07xxxxxx) or/and the command (FUN?) is incorrect, I did not back
how to test
best regards

I says: I send an SMS with a command in the text to a server (Sms.Send2("07xxxxxx","FUN?",True,True) that must answer
if I did not give the right phone number or an incorrect command, I would not receive sms in return
To analyze how this situation
 
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
I says: I send an SMS with a command in the text to a server (Sms.Send2("07xxxxxx","FUN?",True,True) that must answer
if I did not give the right phone number or an incorrect command, I would not receive sms in return
To analyze how this situation

I think I found a solution
I guess the server should respond in less than 2 minutes
Is this the best solution?

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
  
    Dim timer1 As Timer

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim SI_FUN_know As SmsInterceptor
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

    Dim pe As PhoneEvents
    pe.Initialize("PhoneEvent")
    Dim Sms As PhoneSms
    Sms.Send2("337xxxxxxxx","FUN?",True,True)
  
    timer1.Initialize ("Timer1", 120000) '1000 = 1 seconde
    timer1.Enabled = True
  
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Timer1_Tick

    timer1.Enabled = False
  
    Msgbox("erreur num tel ou commande","Anomalie")
    Activity.Finish
  
End Sub

Sub SI_FUN_know_MessageReceived (From As String, Body As String) As Boolean
  
' SMS FUN reçu

    timer1.Enabled = False

    If From.Contains("337xxxxxxxx") = False Or Body.contains("FUN") = False Then
        Return False
    End If
  
    Msgbox("Réception Tel : " & From & " Contenu : " & Body,"Suivi")
  
    Return True
      
End Sub
 
Upvote 0
Top