-3

what this code returns in your countries.

TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String SIMCountryISO=tm.getNetworkCountryIso();

is it return two charater or three char. please reply with your countries and result

user3309272
  • 67
  • 1
  • 1
  • 4

2 Answers2

0

It will return an alpha-2 code.

I am a bit suprised that the API isnt more specific about which type of ISO country code but...

Returns the ISO country code equivalent of the current registered operator's MCC (Mobile Country Code).

Please also note:

  • MCC = Mobile Country Codes and are 3 digits.
  • MNC = Mobile Network Code and can be 2 or 3 digits. The MCC + MNC combination represent a specific carrier.
  • Country ISO (or country code iso) = Normally ISO_3166-1_alpha-2 and are 2 capital letters. They represent a country (not a language).

Since countries never share MCC codes, you can infer the country from just the MCC code. That is exactly what this method does and will return the 2 character ISO code for the country.

Language ISO codes are completely different and represent a specific language. The combination of Language ISO code + Country ISO code is called a locale. The language iso code is normally lower case.

E.g. en_US

Phil
  • 1,996
  • 1
  • 19
  • 26
0

You should be able to find country codes from various resources online. You wouldn't have to go ask the community to do test for you; and doing so is not what StackOverflow is intended for.

Try using a list such as this one to accommodate your needs.

Jay Snayder
  • 4,298
  • 4
  • 27
  • 53