Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Country Code like +91, +1, +65 from the country name like IN, US, SG in Android? [duplicate]

I need to get country code like +91, +1, +65... from the country name like IN, US, SG ... using locale or current Location in android device

i.e suppose if device is in India it returns +91, if device is in US it returns +1, if device is in Singapore it returns +65

I have try so many way but I can't get proper solution.

like image 887
Jayesh Avatar asked Oct 22 '25 13:10

Jayesh


1 Answers

You can get country ID but not code like +91,+1 and so on

TelephonyManager manager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
CountryID= manager.getSimCountryIso().toUpperCase();

You can prepare your own database for that and manually you need to search from database and then handle such kind of operations

check here for this kind of data

like image 127
Ravi Avatar answered Oct 24 '25 04:10

Ravi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!