Skip to content Skip to sidebar Skip to footer

How To Know Sms Number And Phone Number Is The Same?

I'm working on a project that is similar to Message in android. There are 2 types of number : sms number and phone number. For example : I always receive sms with number is: +84973

Solution 1:

Use PhoneNumberUtils.compare to compare both numbers.

Example

//Compare phone numbers a and b, return true if they're identical enough for caller ID purposes.if (PhoneNumberUtils.compare("+84973612399", "0973612399")) {
   Log.d(TAG, "Both are identicaly same"); 
} else {
   Log.d(TAG, "Doesn't match");
}

Result is

Both are identicaly same

Post a Comment for "How To Know Sms Number And Phone Number Is The Same?"