Tuesday, May 20, 2014

[android-developers] Re: Get E-164 format of contacts in Android API less than 16

I've used this before:

This is how ICS does it.

On Friday, May 16, 2014 1:08:21 AM UTC+3, Vijay wrote:
Did you find a solution to this issue ?

I am stuck in the same situation.

On Wednesday, December 4, 2013 9:48:13 AM UTC-8, Rahul Shukla wrote:

I retrieve the list of contact numbers from the phone using the following code:

Cursor c = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);    while(c.moveToNext()){        Log.d(TAG,"NO.: "+ c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER)));  }

In API 16 and above, this would work perfectly for me, as I want ALL the contacts formatted in the E 164 format, no matter how they are stored by the user.

  1. However, for APIs below 16, the above code won't work and I am not able to get the E 164 format for all contacts by using the following line:


The 'PhoneNumberUtils' class could not come to any use.

Also, I cannot use the libphonenumber library to convert numbers to their E 164 format, as I don't know the ISO 3166-1 two letter country-code of the contacts.

Is there any way in which I can obtain the ISO 3166-1 two letter country-code for each contact in Android, so that I can use the libphonenumber library ?

Or is there any other solution to achieve point 1. ?

The numbers retrieved from the phone can be of any format eg.

  • Local : 965XXXXXXX
  • National : 0965XXXXXXX
  • International : +91 96 5X XXXXXX
  • and other

whereas the E 164 is +91XXXXXXXXXX where 91 is the country code.

Any help would be much appreciated !

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment