Heey,
I would like to know the name of the one who sended a message.
This seems to work, but I always got my phone number instead than the name. I know it's related to this (If Contact1.PhoneNumber = MessageFrom1 Then), but I want something like if string.contains (phonenumber) = ... etc
How would I solve this?
XverhelstX
I would like to know the name of the one who sended a message.
B4X:
Sub SI_MessageReceived (From As String, Body As String)
MessageFrom1 = From
MessageBody1 = Body
Dim Contacts1 As Contacts
Dim Contact1 As Contact
Dim listOfContacts As List
Dim list1 As List
listOfContacts = Contacts1.GetAll
For i = 0 To listOfContacts.Size - 1
Contact1 = listOfContacts.Get(i)
If Contact1.PhoneNumber = MessageFrom1 Then
MessageFromName = Contact1.DisplayName
StartActivity(AMessage)
Else
MessageFromName = MessageFrom1
StartActivity(AMessage)
End If
Next
End Sub
This seems to work, but I always got my phone number instead than the name. I know it's related to this (If Contact1.PhoneNumber = MessageFrom1 Then), but I want something like if string.contains (phonenumber) = ... etc
How would I solve this?
XverhelstX