Md. Samsull Arefeen Md. Samsull Arefeen - 24 days ago 10
Android Question

How to get country code or country prefix from a mobile number which doesn't contain country code

I am working on an app which gets a phone number with or without country code to call or to send sms. Now all I want to know, is there any functionality / pattern with which I can detect the country code of a number which doesn't contain the country code.

For example I have the number:
1. 0167-xxxx-xxx
2. 0171-xxxx-xxx
3. 3212-xxx-xxx
4. 4808-xxx-xxx


Here, the first two numbers are from Bangladesh and last two numbers are from Usa. So, is there any way to determine / differentiate the country from those numbers?

Answer

So, is there any way to determine / differentiate the country from those numbers?

No, you simply can't and that's why country codes are used.