Reputation: 9634
i have a number stored in my local contacts like
Xyz 9986799867
Now, i will read this and store it in my DB like
1 | xyz | 9986799867
Suppose if i get call, it will be like +919986799867
My search fails, because there is a mismatch +91 is present in incoming number but not the local database.
If i do same search on contacts DB like,
Cursor cursor = ct.getContentResolver().query(contactUri, projection, null, null, null);
It provides correct name. This is system search, can you tell how its handled internally
Upvotes: 0
Views: 347
Reputation: 732
Option 1: First find the mobile number length it's 10 means directly call select query otherwise use substring method get last 10 digit number after call select query Option 2: Save the mobile no with country code
Upvotes: 0
Reputation: 2292
You can compare a number containing the country code with a number that doesnt't in Java by using the following library :
libphonenumber-6.2.2.jar
With this library you can use isNumberMatch which returns true if the numbers match.
you can find out more here :
Upvotes: 1