Capturing mobile numbers and storing them in your database is very important for effective communications by voice, SMS or other messaging.
This article attempts to highlight some of the key items to address when requesting a mobile number via your app and how it can then be used for use with SMS communications.
E.164 - Wikipedia This link describes the ITU standard.
E.164 phone number format contains:[+][country code][area code][local phone number]
Some countries like Hong Kong do not have area codes.
Here are some examples:
| Country | Local phone number including trunk prefix | E.164 format |
| Australia | 0412123456 | +61412123456 |
| New Zealand | 0211234567 | +64211234567 |
| UK | 07761123456 | +447761123456 |
| Philippines | 09661234567 | +639661234567 |
Take a quick look at this link to see the List of country calling codes - Wikipedia
Some countries do not have trunk codes or are grouped into a single country code. So you realise that it is not that straight forward.
If your app is principally used in Australia and you decide to present a drop down list of all the countries it makes sense to default to Australia +61 in your selection drop down.
That then allows the user to simply enter the remaining part of their number.
Your app knows the country the user is in. Users sometimes get confused over this time and time again because when asked 'what is your mobile number' they automatically say 0412xxxxxx. The leading 0 is sometimes known as a Trunk code or long distance code or by other names.
So they are inclined to simply enter 0412xxxxxx in the remaining part of the mobile number field for your app to process and write to your database.
The issue is that the leading 0 is not required to format a mobile number in E.164 format.
+61 412xxxxxx is the correct format for global use. We have intentionally split the country code from the remaining part of the number in this example so it is clear to the developer how to potentially store the number in their database. We are not saying this is the only way it can be done.
Tip: provide an example of that format just above the field on the screen.
The screen tip could say "leading 0 is not required".
Your app can look for a leading 0 in the field the user enters and safely remove it. Many countries use a leading 0 as a trunk code.
Some developers store mobile numbers in their databases in 2 parts to make it easier for them to allow further editing via their app.
Mobile number
Mobile Country Code xxxx
Mobile Rest of number xxxxxxxxxxxxxx
The SMS platform requires the number to be presented in E.164 format including the + symbol.
Destination mobile phone number example for Australia SMS: +61412xxxxxx