Android Question Error in sending SMS is displayed only once.

Orcino Borges

Member
Licensed User
Longtime User
Hello everybody.

I have three buttons that send three different SMS. If Error occurred in sending the SMS, it shows an error. This is working.

But if I press the button again, the message will not appear. Only appears the first time.

In short:

1 - I press the button to send the SMS.

2 - Is the error shown - This ok. I'm testing this same

3 - If I press the same button again. The error is not shown again.

4 - If I press another button. The error is shown.

Can anyone help me?

thanks

B4X:
Sub DesLiga2_Down
   
    If btDesliga2=0 Then           
          msg.Send(Main.nDigitado,"#" & Main.senhaDigitada & " desliga saida 2")
          btDesliga2=1
          Dbutton=2   
    End If
   
End Sub

Sub DesLiga1_Down
   
    If btDesliga1=0 Then   
          msg.Send(Main.nDigitado,"#" & Main.senhaDigitada & " desliga saida 1")
          btDesliga1=1
          Dbutton=1   
    End If
   

End Sub



Sub DesLiga3_Down
   
    If btDesliga3=0 Then   
          msg.Send(Main.nDigitado,"#" & Main.senhaDigitada & " desliga saida 3")
          btDesliga3=1
          Dbutton=3
    End If
   

'----------------------------------------------------------------------------------------------

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


 If Success=True Then
     Msgbox("Comando enviado","")
     btStatus=0
     Status.enabled=True
   
   Select Lbutton ' botões de ligar as saídas
   
      Case 1
           Lbutton=0
            btDesliga1=0
           Liga1.Enabled=False
            DesLiga1.Enabled=True
           Liga1.Text="Saída 1 ligada"
           DesLiga1.Text="Desliga Saída 1"
   
       Case 2
           Lbutton=0
            btDesliga2=0
            Liga2.Enabled=False
            DesLiga2.Enabled=True
           Liga2.Text="Saída 2 ligada"
           DesLiga2.Text="Desliga Saída 2"
   
       Case 3
          Lbutton=0
          btDesliga3=0
          Liga3.Enabled=False
          DesLiga3.Enabled=True
          Liga3.Text="Saída 3 ligada"
          DesLiga3.Text="Desliga Saída 3"

   
       End Select
   
   
       Select Dbutton  ' botões de desligar as saidas
       
        Case 1
          Dbutton=0
          btLiga1=0
          DesLiga1.Enabled=False
          Liga1.Enabled=True
          DesLiga1.Text="Saída 1 desligada" 
          Liga1.Text="Liga saída 1"
       
       
        Case 2
          Dbutton=0
          btLiga2=0
          DesLiga2.Enabled=False
          Liga2.Enabled=True
          DesLiga2.Text="Saída 2 desligada" 
          Liga2.Text="Liga saída 2"
       
       
        Case 3
          Dbutton=0
          btLiga3=0
          DesLiga3.Enabled=False
          Liga3.Enabled=True
          DesLiga3.Text="Saída 3 desligada" 
          Liga3.Text="Liga saída 3"
       
       End Select 
         
   
    End If


    If Success=False Then
       Msgbox("Comando não enviado ", "Verifique n., saldo, sinal, etc")
    End If
   

End Sub


End Sub



B4X:
'Service module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    '
Dim MessageFrom1 As String
Dim MessageBody1 As String
'Dim Ntel As String
Dim SI As SmsInterceptor
   
End Sub
Sub Service_Create
   
    SI.Initialize2("SI",999)
         
End Sub

Sub Service_Start

End Sub

Sub SI_MessageReceived (From As String, Body As String) As Boolean
   
    MessageFrom1 = From
    MessageBody1 = Body
       
        If config.flagConfigMsg=1 Then
            CallSubDelayed("config","msgRecebidaCnfg")
        End If
       
        If Comando.flagCmdMsg=1 Then
          CallSubDelayed("Comando","msgRecebidaCMD")
        End If
       
End Sub
 
Top