Dear Erel,
Using the ContactUtils is much and much faster to find & load all Contacts from phone than using Phone and Contacts2 library. Earlier, I did that task with more than 12 sec. (as also reported by other members), now this task is done very quickly, almost immediately or < 1 sec.
However, I still have a problem of implementing this class. It is related to the phone number format issue which still remains an unanswered question for me.
If I want to find a stored Contact name by using the phone number and "FindContactsByPhone", I have to know exactly the phone number that I stored earlier. Let say in the past I stored "003311223344" now if my searching number is "0033-1122-3344", then I cannot find out this Contact.
I am doing anything wrong? How can we eliminate the "phone number format" factor when doing search, as the user can enter (store) every kind of format they want, let say 0033-1122-3344 or (00) 33 1122- 3344 and so on...
Currently what I am doing is to "manually" compare the user number and the stored Contact number by removing all the symbolic characters and spaces programmatically, as well as removing the prefix... then I compare their Substring.
Using the ContactUtils is much and much faster to find & load all Contacts from phone than using Phone and Contacts2 library. Earlier, I did that task with more than 12 sec. (as also reported by other members), now this task is done very quickly, almost immediately or < 1 sec.
However, I still have a problem of implementing this class. It is related to the phone number format issue which still remains an unanswered question for me.
If I want to find a stored Contact name by using the phone number and "FindContactsByPhone", I have to know exactly the phone number that I stored earlier. Let say in the past I stored "003311223344" now if my searching number is "0033-1122-3344", then I cannot find out this Contact.
I am doing anything wrong? How can we eliminate the "phone number format" factor when doing search, as the user can enter (store) every kind of format they want, let say 0033-1122-3344 or (00) 33 1122- 3344 and so on...
B4X:
Sub Button2_Click
Dim phoneList As List
phoneList.Initialize
phoneList = cu.FindContactsByPhone("0033-1122-3344", False, False)
For i = 0 To phoneList.Size - 1
ToastMessageShow(phoneList.Get(i), False)
Next
End Sub
Currently what I am doing is to "manually" compare the user number and the stored Contact number by removing all the symbolic characters and spaces programmatically, as well as removing the prefix... then I compare their Substring.