use of com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder in project platform_frameworks_base by android.
the class CallerInfo method getGeoDescription.
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
*/
private static String getGeoDescription(Context context, String number) {
if (VDBG)
Rlog.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
}
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
Locale locale = context.getResources().getConfiguration().locale;
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
if (VDBG)
Rlog.v(TAG, "parsing '" + number + "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
if (VDBG)
Rlog.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
Rlog.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + Rlog.pii(TAG, number) + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
if (VDBG)
Rlog.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
}
}
use of com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder in project XobotOS by xamarin.
the class CallerInfo method getGeoDescription.
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
*/
private static String getGeoDescription(Context context, String number) {
if (VDBG)
Log.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
}
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
Locale locale = context.getResources().getConfiguration().locale;
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
if (VDBG)
Log.v(TAG, "parsing '" + number + "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
if (VDBG)
Log.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
Log.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
if (VDBG)
Log.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
}
}
use of com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder in project android_frameworks_base by ResurrectionRemix.
the class CallerInfo method getGeoDescription.
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
*/
public static String getGeoDescription(Context context, String number) {
if (VDBG)
Rlog.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
}
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
Locale locale = context.getResources().getConfiguration().locale;
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
if (VDBG)
Rlog.v(TAG, "parsing '" + number + "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
if (VDBG)
Rlog.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
Rlog.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
if (VDBG)
Rlog.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
}
}
use of com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder in project android_frameworks_base by DirtyUnicorns.
the class CallerInfo method getGeoDescription.
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
*/
public static String getGeoDescription(Context context, String number) {
if (VDBG)
Rlog.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
}
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
Locale locale = context.getResources().getConfiguration().locale;
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
if (VDBG)
Rlog.v(TAG, "parsing '" + number + "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
if (VDBG)
Rlog.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
Rlog.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
if (VDBG)
Rlog.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
}
}
use of com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder in project android_frameworks_base by crdroidandroid.
the class CallerInfo method getGeoDescription.
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
*/
public static String getGeoDescription(Context context, String number) {
if (VDBG)
Rlog.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
}
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
Locale locale = context.getResources().getConfiguration().locale;
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
if (VDBG)
Rlog.v(TAG, "parsing '" + number + "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
if (VDBG)
Rlog.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
Rlog.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
if (VDBG)
Rlog.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
}
}
Aggregations