您可以使用MCC MNC获取SIM卡国家/地区,它是SIM配置的,与您所在的网络无关.
Configuration config = getResources().getConfiguration();
int countryCode = config.mcc;
您可以在此处找到MCC列表MccTable.java
例如,西班牙是214,法国是208
MCC should work on all GSM devices with SIM card but it is unreliable on CDMA networks
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
Class> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
// Gives MCC + MNC
String homeOperator = ((String) get.invoke(c, "ro.cdma.home.operator.numeric"));
String country = homeOperator.substring(0, 3); // the last three digits is MNC
} else {
Configuration config = getResources().getConfiguration();
int countryCode = config.mcc;
}