Android: Phone numberformat on incoming call, determining country code?
-
14-11-2019 - |
Question
Im building an application that reads an incoming phonenumber, so far no problem.
But i want my app to be able to determine the country code for the incoming number if the number is international.
Is there a simple solution for this?
Im uncertain if the country code always will be a fixed set of numbers, say +001 for US or only +1. If i knew that it will always be say three digist it would be very simple.
Iv taken a look at the PhoneNumberUtils class, but so far i haven't struck gold :(
Any ideas?
Regards,
Fredrik
Solution
The country code is one to three digits. There's a list at
http://en.wikipedia.org/wiki/List_of_country_calling_codes
The libphonenumber tools have exactly what you want.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow