Språk

PhoneNumberManager.ParsePhoneNumber(IList<Uri>, String) Method

Definition

Parses the associated URIs into a ParsedPhoneNumber object.

[Android.Runtime.Register("parsePhoneNumber", "(Ljava/util/List;Ljava/lang/String;)Landroid/telephony/ParsedPhoneNumber;", "GetParsePhoneNumber_Ljava_util_List_Ljava_lang_String_Handler", ApiSince=36)]
public virtual Android.Telephony.ParsedPhoneNumber ParsePhoneNumber(System.Collections.Generic.IList<Android.Net.Uri>? associatedUris, string countryIso);
[<Android.Runtime.Register("parsePhoneNumber", "(Ljava/util/List;Ljava/lang/String;)Landroid/telephony/ParsedPhoneNumber;", "GetParsePhoneNumber_Ljava_util_List_Ljava_lang_String_Handler", ApiSince=36)>]
abstract member ParsePhoneNumber : System.Collections.Generic.IList<Android.Net.Uri> * string -> Android.Telephony.ParsedPhoneNumber
override this.ParsePhoneNumber : System.Collections.Generic.IList<Android.Net.Uri> * string -> Android.Telephony.ParsedPhoneNumber

Parameters

associatedUris
IList<Uri>

The list of URIs to be parsed. The order of the URIs in the list matters. The method iterates through the list and stops at the first URI that can be parsed into a valid phone number. It is recommended to place the URIs that are most likely to contain a valid phone number at the beginning of the list.

countryIso
String

The country ISO code to be used for parsing.

Returns

A ParsedPhoneNumber containing the first valid phone number, or an invalid result if no valid number was found.

Attributes

Exceptions

In the Android SDK 37.2 implementation, associatedUris is null or empty, or countryIso is null or empty.

Remarks

Parses the associated URIs into a ParsedPhoneNumber object.

This method attempts to parse the provided list of URIs into a valid phone number. The order of the URIs in the list is significant; it is recommended to prioritize URIs that are more likely to contain a valid phone number by placing them at the beginning of the list. The method iterates through the list and returns a result for the first URI that can be successfully parsed into a valid phone number.

In the Android SDK 37.2 implementation, an invalid result can have an error code of 0 (None) when no specific error was recorded, such as when all URIs are null or non-opaque.

Java documentation for android.telephony.PhoneNumberManager.parsePhoneNumber(java.util.List<android.net.Uri>, 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