Hi! First of all I huge hug from Argentina to all community of this forum. Sorry for my english.
I'm newbie programming with B4A but I love it.
I'm developing an app and have to know which is the Whatsapp number for a selected contact on phone.
First, I fill an autocompletetextbox with all contacts in phone. Then, user select a contact, and I use the following Sub to fill a customlistview (CLV1) with all releated phones for that user (work / home/ mobile, etc).
Sub AutoCompleteTextBox_ItemClick (Value As String)
For Each c As cuContact In cu.FindAllContacts(True)
If c.DisplayName = Value Then
For Each phone As cuPhone In cu.GetPhones(c.Id)
CLVSugerirContacto.AddTextItem(phone.Number & " (" & phone.PhoneType & ")",phone.Number)
Next
Exit
End If
Next
End Sub
All works great but the problem is that neither of all showed phones number are in Whatsapp format like +country/city/phone_number and when I try to use that phone to send a whatsapp message using "Intent1.Initialize(Intent1.ACTION_VIEW, "https://api.whatsapp.com/send?phone="&number_in_whatsapp_format&"&text=message here") an error message is displayed saying that the number is not a Whatsapp contact.
For example, if I have a contact number saved as "0291-123456" (without country code), on my phone appears the whatsapp logo and says "Send message to +54-291-123456". So that means whatsapp modify the format of the number but only for its own use. Is there a way to know whatsapp contacts number, or I have to format wrong numbers by code?
I'm newbie programming with B4A but I love it.
I'm developing an app and have to know which is the Whatsapp number for a selected contact on phone.
First, I fill an autocompletetextbox with all contacts in phone. Then, user select a contact, and I use the following Sub to fill a customlistview (CLV1) with all releated phones for that user (work / home/ mobile, etc).
Sub AutoCompleteTextBox_ItemClick (Value As String)
For Each c As cuContact In cu.FindAllContacts(True)
If c.DisplayName = Value Then
For Each phone As cuPhone In cu.GetPhones(c.Id)
CLVSugerirContacto.AddTextItem(phone.Number & " (" & phone.PhoneType & ")",phone.Number)
Next
Exit
End If
Next
End Sub
All works great but the problem is that neither of all showed phones number are in Whatsapp format like +country/city/phone_number and when I try to use that phone to send a whatsapp message using "Intent1.Initialize(Intent1.ACTION_VIEW, "https://api.whatsapp.com/send?phone="&number_in_whatsapp_format&"&text=message here") an error message is displayed saying that the number is not a Whatsapp contact.
For example, if I have a contact number saved as "0291-123456" (without country code), on my phone appears the whatsapp logo and says "Send message to +54-291-123456". So that means whatsapp modify the format of the number but only for its own use. Is there a way to know whatsapp contacts number, or I have to format wrong numbers by code?