PhoneNumberManager


open class PhoneNumberManager
kotlin.Any
   ↳ android.telephony.PhoneNumberManager

PhoneNumberManager provides APIs for parsing phone numbers from various sources, such as URIs.

Summary

Public methods
open ParsedPhoneNumber
parsePhoneNumber(associatedUris: MutableList<Uri!>?, countryIso: String)

Parses the associated URIs into a ParsedPhoneNumber object.

Public methods

parsePhoneNumber

open fun parsePhoneNumber(
    associatedUris: MutableList<Uri!>?,
    countryIso: String
): ParsedPhoneNumber

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 will iterate through the list and return the first URI that can be successfully parsed into a valid phone number.

Parameters
associatedUris MutableList<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. This value may be null.
countryIso String: The country ISO code to be used for parsing. This value cannot be null.
Return
ParsedPhoneNumber A ParsedPhoneNumber object representing the first successfully parsed phone number from the provided list or an error if no numbers could be parsed. This value cannot be null.