Contact.GetPhones returns blank

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm trying to make a contacts program, but for every contact in my list GetPhones returns an empty map
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Sub EnumContacts(Name As String) As List
Dim CON As Contacts , Names As List 'returns a list of type Contact
If Name.Length =0 Then
Names = CON.GetAll
Else If IsNumber(Name) Then
Names = CON.GetById(Name)
Else If Name.Contains("@") AND Name.Contains(".") Then
Names = CON.FindByMail(Name,False)
Else
Names = CON.FindByName(Name,False)
End If

'debug
Dim temp As Int, tempContact As Contact , tempMap As Map
For temp = 0 To Names.Size-1
tempContact= Names.Get(temp)
Log(tempContact)
tempMap=tempContact.GetEmails
Log(tempMap)
tempMap=tempContact.GetPhones

Log(tempMap)

EnumCallLogs(20,tempMap)
EnumSMSmessages(tempContact.Id)
Next

Return Names
End Sub
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Adding
B4X:
If tempContact.PhoneNumber.Length>0 Then Log(tempContact.DisplayName & " " & tempContact.PhoneNumber )
inside the loop also never prints a phone number.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Weird. I added a phone number to a contact on my tablet, and now when I run the code on my phone it shows up.

The Google contacts show up, phone contacts do not.

I will try contacts2 instead
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
Arg, with contacts2 I'm only getting stuff from the online contact list, not the local one.

Is there any way to get both without using both contacts and contacts2(which would be very slow)
 
Top