I'm also wondering about how to do this.
We also require the country code in our APP. Our app is international, meaning that both the format of the phone number AND the format of the country code may-drastically-vary(1), making it hard to see if there is an edge case we are not taking into account in our search for the country code.
It's always helpful to hear how you would use this functionality - would love to hear your thoughts on it.
Our use case is as follows:
- Get user's contacts.
- Query our databases to find "friends" based on internationally formatted phone numbers.
- If a contact without a country code (not internationally formatted) is found, assume it is local to the user's country code. Which because of the unknown edge cases mentioned above, the probability of error propagates to this assumption.
Some user stories based on the idea of a possible error when tracking down the country code:
- As a user, I don't want to start a conversation with a friend just to realize it is not that person.
- As a user, I want to be able to accurately find people in my contacts that have the application.