I can obtain the phone number from an incoming call or from a sms message. unfortunately, in case of the SMS there might be the country code in it. So, basically I need to obtain the plain phone number, without country code, in order to compare it with existing numbers in Contacts.
Back to New Call; click Dialing Options; check Automatically add country/region code to local phone numbers.)
The plus sign before the country code means "add the exit code" of the country you are dialing from. So, using the example above, if you were dialing from the US you would replace the plus sign with 011, while, if dialing from one of the numerous countries using exit code 00, you would instead have 00 44 700 000 0000.
Country codes are short alphabetic or numeric geographical codes (geocodes) developed to represent countries and dependent areas, for use in data processing and communications.
If you want to compare phone numbers you can always use the
PhoneNumberUtils.compare(number1, number2);
or
PhoneNumberUtils.compare(context, number1, number2);
Then you don't have to worry about the country code, it will just compare the numbers from the reversed order and see if they match (enough for callerID purposes at least).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With