Hi,
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:
>    
>    
> c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
>    
>    
> The 'PhoneNumberUtils' class could not come to any use.
>
> Also, I cannot use the 
> libphonenumber<http://code.google.com/p/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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to