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