Share via


PhoneNumberUtils.AreSamePhoneNumber(String, String, String) Method

Definition

Determines if two phone numbers are the same.

[Android.Runtime.Register("areSamePhoneNumber", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", "", ApiSince=31)]
public static bool AreSamePhoneNumber (string number1, string number2, string defaultCountryIso);
[<Android.Runtime.Register("areSamePhoneNumber", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", "", ApiSince=31)>]
static member AreSamePhoneNumber : string * string * string -> bool

Parameters

number1
String

number1

number2
String

number2

defaultCountryIso
String

The lowercase two letter ISO 3166-1 country code. Used when parsing the phone numbers where it is not possible to determine the country associated with a phone number based on the number alone. It is recommended to pass in TelephonyManager#getNetworkCountryIso().

Returns

True if the two given phone number are same.

Attributes

Remarks

Determines if two phone numbers are the same.

Matching is based on libphonenumber. Unlike #compare(String, String), matching takes into account national dialing plans rather than simply matching the last 7 digits of the two phone numbers. As a result, it is expected that some numbers which would match using the previous method will no longer match using this new approach.

Java documentation for android.telephony.PhoneNumberUtils.areSamePhoneNumber(java.lang.String, java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to