Android Question ContactsUtils.FindContactsByPhone pattern

peacemaker

Expert
Licensed User
Longtime User
HI, All

I have found that my contacts were saved sometimes without delimiters like "12345678", but sometimes with spaces and\or "-" like "123 45-678".
And note that i did not enter these delimiters - it seems to be due to various Android versions saved contacts into the Google account such ways.

BTW, the calls log shows all numbers all without delimiters.

And now, when i try to .FindContactsByPhone - saved contact with number "12345678" is not found by the first time. And the calls log shows this incoming call number as unknown, without a name.

But if to make a new call and search second time - it's found among contacts ! And calls log also shows the contact name together with this number.

How to understand it and to be sure that delimiters are not used during finding process ?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
More over - some contacts are with "(XXX)" :(
So, it needs to modify searching by phone number by this ContactsUtils class.
Now it can be only by
1) .FindAllContacts
2) iterating cuContacts
3) iterating cuPhones of each cuContact
4) removing "+", " ", "-", "(", ")" in each cuPhone
5) and only here to compare the number with needed one
Such searching is several seconds at last, very long :(

How to make SQL request with removing these ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Yes, Erel, thanks, but it's not universal way. It will be for sure if to select the latest one digit only firstly :)
But no way to filter by SQL request ?
 
Upvote 0
Top