google libphonenumber get only mobile numbers from contacts
Asked Answered
C

2

1

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 a list with all mobile area codes like https://en.wikipedia.org/wiki/List_of_mobile_phone_number_series_by_country and check every number but this is a bit complicated I think.

Copulative answered 1/8, 2015 at 10:9 Comment(0)
C
4

found the answer...

PhoneNumberUtil.PhoneNumberType nrtype = phoneUtil.getNumberType(NumberProto);
if (nrtype.name() == PhoneNumberUtil.PhoneNumberType.MOBILE) {
}
Copulative answered 1/8, 2015 at 10:26 Comment(1)
maybe should be : if(nrtype == PhoneNumberUtil.PhoneNumberType.MOBILE)Chere
A
-1
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);
Ademption answered 1/8, 2015 at 10:12 Comment(1)
Please explain your answerDerrek

© 2022 - 2024 — McMap. All rights reserved.