public class SimUtil {
/**
* 中国移动
*/
public static final int SIM_TYPE_CHINA_MOBILE = 1;
/**
* 中国联通
*/
public static final int SIM_TYPE_CHINA_UNICOM = 2;
/**
* 中国电信
*/
public static final int SIM_TYPE_CHINA_TELECOM = 3;
/** SIM卡是中国移动 */
public static boolean isChinaMobile() {
String imsi = getSimOperator();
if (imsi == null) return false;
return imsi.startsWith("46000") || imsi.startsWith("46002") || imsi.startsWith("46007");
}
/** SIM卡是中国联通 */
public static boolean isChinaUnicom() {
String imsi = getSimOperator();
if (imsi == null) return false;
return imsi.startsWith("46001");
}
/** SIM卡是中国电信 */
public static boolean isChinaTelecom() {
String imsi = getSimOperator();
if (imsi == null) return false;
return imsi.startsWith("46003");
}
private static String getSimOperator() {
TelephonyManager tm = (TelephonyM
Android 识别SIM卡类型
最新推荐文章于 2021-06-02 18:50:06 发布