Hi, I have an app that needs login creds, it a security app and I want users to be able to login by texting the phone. I have a service that listens for SMS's but I dont know how to make the if statement check the message for "lostmode user pass pin" because the user, pass and pin will differ depending on the user. If someone could just give an if statement like, If Msg contains 4 words (then check if the first one is lostmode) I would handle the rest. Thanks! BTW I know that is a fake "If" statement. Heres my code:
B4X:
Sub Process_Globals
Dim SMSIntercept1 As SmsInterceptor
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
SMSIntercept1.Initialize2("SI",99999)
End Sub
Sub Service_Destroy
CallSub(Main, "RestartService1")
End Sub
Sub SI_MessageReceived(From As String, Msg As String) As Boolean
If Msg = "lostmode user pass pin" Then
Return True
End If
End Sub
Hi, it works but what if the user puts a captial "Lostmode"? Ive tried this:
B4X:
Sub SI_MessageReceived(From As String, Msg As String) As Boolean
ListData2 = Regex.Split(" ", Msg)
If ListData2.Get(0) = "lostmode" OR "Lostmode" Then
ToastMessageShow(ListData2.Get(0), True)
End If
End Sub
convert both to lower or uppercase and THEN compare them
B4X:
Dim listdata2() As String
listdata2 = Regex.Split(" ", "LoStMoDe bla ")
For Each data As String In listdata2
If data.ToUpperCase = "LOSTMODE" Then
End If
Next