开发者

Phone number contact format in Android

开发者 https://www.devze.com 2022-12-27 22:04 出处:网络
In Android I can get phone numbers of all the contacts without any problem. The problem is that for most users some numbers are stored as \'local\' numbers, meaning that they dont have the country c

In Android I can get phone numbers of all the contacts without any problem.

The 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 numb开发者_开发知识库ers doesnt include the country code? Any way to figure that out?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消