I am doing an application where I need to store some numbers and when someone call on phone I need to check if incoming number is present in my database or not.
What I did
I stored phone numbers in shared preferences. Internally android uses Map for this purpose.
Problem:
Lets say I stored 9089889899 (10 digit phone number). Now if I get an incoming call from this number it may BroadcastReceiver having 09089889899 or +91-9089889899 number for the same.
So my problem is that if I stored a number into preferences then how can I match the incoming number is present in preferences or not.
I suggest that you use something like libphonenumber to handle the phone numbers independent of the format.
There is also some functions for formatting and comparing numbers in PhoneNumberUtils.