views:

650

answers:

2

Hi

In Android I can get phone numbers of all the contacts without any problem. Tha problem is that for most users some numbers are stored as 'local' numbers, meaning that they dont have the country code included.

For example, if the user lives in US and he has 2 contacts:

1) John - 555-123-1234 (local) (starting 1 not showing)

2) Jane - 44-123456787 (england phone number)

The question is: How do I get all the numbers in an international format, when some of the numbers doesnt include the country code? Any way to figure that out?

Thanks

A: 

Check out android.telephony.PhoneNumberUtils and see if one of its static methods does what you need.

CommonsWare
thanks, but I didnt find any method in PhoneNumberUtils that could help me with my problem. I think the only way to do it is to have a list of all country codes in a table, and if the number starts with a + sign, I know its international and I can figure out from what country, if not, I know its local.
Daniel Benedykt
+1  A: 

I think the only way to do this is to have a table with all country codes and figure out what country the phone number is.

Daniel Benedykt