views:

31

answers:

1

Hi stackies,

the users of my app will provide me the recipient's phone numbers of the text messages they will be writing. How can I ensure the usage of the international phone number format when the user provides a NATIONAL format while sending a message to a person who is located in his own country? Would I have to actually KNOW all the national syntaxes for phone numbers that are used in every single country I have users in? If that is the case (what I SO wish that it is not), does anyone know a list of the syntaxes? And if not, what is the alternative? An out-of-Android-solution maybe? :)

Thanks in advance!

Best regards
S.

A: 

Hi,

As I know the international format of telephone number is +--.['-' used for separation and representation only. ]

When a user put this format all the telecom operators will be able to parse and redirect them to the correct network (Even in case of when the other phone is with in the same country or region)

So, if you follow this format should be suffice.

Here is a link to Wiki for your reference.

regards,
Vinay

Vinay
Hi Vinay, right, but how can I handle a phone number for which the user *didn't* use this format?! :) My problem is that I don't really know how to reliably extract area code and local number to add the country code and finally generate a valid international number.
Sotapanna
Ok, My suggestion here would be that, 1. if the phone number starts with '+' -> assume this to be International format. 2. If the phone number does not start with country code [use getNetworkCountryIso()] assume this to be local number. Now add the country code got above and try it out.
Vinay
I thought about this approach, as well, but I would at least sometimes need to edit the local number before adding the country code. For example, for german number I would have to cut the first digit off the number, as the area code in Germany always starts with a 0 that is dropped when internationalized. Knowing what to do with the local area codes is my main issue, I guess... :-s
Sotapanna
@Vinay: Isn't '+' just a short-hand to '00'? I am not sure how it is in other countries, but it surely is that way in Poland.
Paweł Dyda
+ is just a substitution for the int. access code. This is different for example in the States...
Sotapanna
@Pawel '+' Stands for the international dialing format...
Vinay