getNameForNumber method
Gets the name of the carrier for the given phone number, in the language provided. As per getNameForValidNumber(PhoneNumber, Locale) but explicitly checks the validity of the number passed in.
number
the phone number for which we want to get a carrier name
languageCode
the language code in which the name should be written
returns a carrier name for the given phone number, or empty string
if the number passed in is invalid
Implementation
String getNameForNumber(PhoneNumber number, Locale languageCode) {
PhoneNumberType numberType = _phoneUtil.getNumberType(number);
if (isMobile(numberType)) {
return getNameForValidNumber(number, languageCode);
}
return "";
}