README.md
1# Demo App: E.164 Formatter
2
3## What is this?
4
5The E.164 Formatter is an Android App that reads all the phone numbers stored in
6the device's contacts and processes them using the
7[LibPhoneNumber](https://github.com/google/libphonenumber) Library.
8
9The purpose of this App is to show an example of how LPN can be used in a
10real-life situation, in this case specifically in an Android App using Java.
11
12## How can I install the app?
13
14You can use the source code to build the app yourself.
15
16## Where is the LPN code located?
17
18The code using LPN is located in
19[`PhoneNumberFormatting#formatPhoneNumberInApp(PhoneNumberInApp, String,
20boolean)`](app/src/main/java/com/google/phonenumbers/demoapp/phonenumbers/PhoneNumberFormatting.java#L31)
21.
22
23## How does the app work?
24
25On the start screen, the app asks the user for a country to later use when
26trying to convert the phone numbers to E.164. After the user starts the process
27and grants permission to read and write contacts, the app shows the user two
28lists in the UI.
29
30**List 1: Formattable**
31
32Contains all the phone number that are parsable by LPN, are not short numbers,
33and are valid numbers and can be reformatted to E.164 using the country selected
34on the start screen. In other words, valid locally formatted phone numbers of
35the selected country (e.g. `044 668 18 00` if the selected country is
36Switzerland).
37
38Each list item (= one phone number in the device's contacts) has a checkbox.
39With the click of the button "Update selected" under the list, the app replaces
40the phone numbers of the checked list elements in the contacts with the
41suggested E.164 replacements.
42
43**List 2: Not formattable**
44
45Shows all the phone number that do not fit the criteria of List 1, each tagged
46with one of the following errors:
47
48* Parsing error
49* Short number (e.g. `112`)
50* Invalid number (e.g. `+41446681800123`)
51* Already E.164 (e.g. `+41446681800`)
52