How to find out the country of the user's SIM card on Android?

svenkapudija picture svenkapudija · Mar 15, 2011 · Viewed 9.2k times · Source

Is there a way to check what is the user's country? "Locale" isn't good enough because there are plenty of English locales but they are spread all over the world.

Maybe somehow with IMEI or...?

So actually I need to find out which country does the SIM card belong to?

EDIT: GPS or internet are not allowed.

Answer

lucian.pantelimon picture lucian.pantelimon · Mar 15, 2011
android.telephony.TelephonyManager.getNetworkCountryIso()

More info Android documentation - TelephonyManager.

Edit: Depends what you are looking for. IMEI may not be relevant as the phone might have been ordered/bought from another country or the user might be in another country when using it. Also I don't know if the IMEI tells you the actual contry the device is being sold in, but rather the country of the manufacturer (not sure on this one though).