The proposed solutions using Locale
return ISO 3166-1 alpha 3 codes, not ISO 3166-1 numeric ones. The solution I found was using the following library (in our specific case, given it is Apache 2.0 license we just copied the CountryCode
class with some slight modifications to make it self-contained):
https://github.com/TakahikoKawasaki/nv-i18n
(found in the following answer).
Then, your code becomes:
TelephonyManager manager = (TelephonyManager)getSystemService(this.TELEPHONY_SERVICE);
String ISO2 = manager.getSimCountryIso();
String ISO3_numeric = CountryCode.getByAlpha2Code(ISO2).getNumeric();