Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the country (or its ISO code)?

What is the best way to get the country code?

As of now, I know two ways. One is to get by TelephonyManager and another by Locale. Which is another best and unique way to find the country code on Android?

like image 767
Vishal Pawar Avatar asked Aug 31 '12 07:08

Vishal Pawar


People also ask

What is ISO country code?

The ISO country codes are internationally recognized codes that designate every country and most of the dependent areas a two-letter combination or a three-letter combination; it is like an acronym, that stands for a country or a state. The country code is in use for example for the two-letter suffixes such as .

How do I get a country phone prefix ISO?

I got the country iso by the code from this answer: TelephonyManager tm = (TelephonyManager)getSystemService(Context. TELEPHONY_SERVICE); String countryCode = tm.

What is ISO country code of India?

ISO 3166-2:IN is the entry for India in ISO 3166-2, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), which defines codes for the names of the principal subdivisions (e.g., provinces or states) of all countries coded in ISO 3166-1.


1 Answers

Try this:

TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String countryCode = tm.getSimCountryIso(); 
like image 101
Sahil Mahajan Mj Avatar answered Oct 04 '22 21:10

Sahil Mahajan Mj