Skip to content Skip to sidebar Skip to footer

Google Libphonenumber Get Only Mobile Numbers From Contacts

I'm using libphonenumber to format phonenumbers in contacts. Is there any way to display only mobile numbers like WhatsApp? no local phone numbers. The only idea I have is to have

Solution 1:

found the answer...

PhoneNumberUtil.PhoneNumberType nrtype = phoneUtil.getNumberType(NumberProto);
if (nrtype.name() == PhoneNumberUtil.PhoneNumberType.MOBILE) {
}

Solution 2:

Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, personId);

Uri phonesUri = Uri.withAppendedPath(personUri, People.Phones.CONTENT_DIRECTORY);
String[] proj = new String[] {Phones._ID, Phones.TYPE, Phones.NUMBER, Phones.LABEL}

Cursor cursor = contentResolver.query(phonesUri, proj, null, null, null);

Post a Comment for "Google Libphonenumber Get Only Mobile Numbers From Contacts"