There are often problems when it comes to roaming.
For example, domestic long-distance calls, fixed telephone dialing area code and so on. You need to add a 0086 prefix to a foreign country. So what exactly is the situation?
Roaming, leaving its own registered service area, moving to another area, mobile communications can still provide it with the functionality of the service. Between regions or countries that require a network-compatible and already networked domestic city or have signed a bilateral roaming agreement.
First talk about mobile phones, the general now is the opening of the domestic long-distance (PHS has been abolished). But the need to add international identification code, such as a attribution to China for 18699998888 of the phone to call Macau +85366224209 (perhaps I was mistaken), then dial +853 directly plus the number on the back of Macau can be. Macau calls China in front of the phone number to add +86 on it. What is "+", according to Wikipedia, can use the "+" number to replace the local country (you in which country or region to call the code of International calls), such as in China or Europe is generally 00, and in North America is 1,gsm 00 and 1 made a mark directly with "+" to replace, This can be identified by operators in areas that support the GSM format. Because the operator is doing this call transfer service. CDMA I haven't thought about it yet.
Google as a global company to provide a libphonenumber jar package, on GitHub has its open source project, introduced a variety of formats, easy to use. You can also do things together with the SIM information provided by Android's own Telephonymanager class. For example, get SIM registered address (base station location) and country code, carrier information and so on.
The Global telecommunication organization has made some efforts to standardize, but because of the long-term market development, there are still some other formats. At present the more famous is the E164 format, is I above the similar +8613555556666 and so on. There are other possible middle plus "-" and so on.
Phonenumberutil Phoneutil == (Telephonymanager) Context.getsystemservice (context.telephony_service); Try { = Tm.getnetworkcountryiso (); The Country code of the network operator that returned the SIM card registration Phonenumber.phonenumber numberproto = Phoneutil.parse (incomingnumber , Networkiso.touppercase (Locale.english)); = Phoneutil.format (Numberproto, PhoneNumberUtil.PhoneNumberFormat.E164);
This is a simple code that gets the E164 number after the call number is formatted.
Rules for international phone numbers