SystemUI获得SIM卡相关的mcc/mnc值,分两种情况讨论
1. 存储在SIM卡中的mcc/mnc
这个值是存储在SIM卡IMSI(国际移动用户识别码 International Mobile Subscriber Identification Number)中的固定值,不会被更改。有以下两种途径可以取得。
1.1 通过TelephonyManager获得
在TelephonyManager中有如下方法:
//TelephonyManager.java
/**
* Returns the MCC+MNC (mobile country code + mobile network code) of the
* provider of the SIM for a particular subscription. 5 or 6 decimal digits.
*
* Availability: SIM state must be {@link #SIM_STATE_READY}
*
* @see #getSimState
*
* @param subId for which SimOperator is returned
* @hide
*/
public String getSimOperatorNumeric(int subId) {
int phoneId = SubscriptionManager.getPhoneId(subId);
return getSimOperatorNumericForPhone(phoneId);
}
/**
* Returns the MCC+M