TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
方法一:telManager.getNetworkOperatorName()
中国电信 China Telecom
中国移动 China Mobile
中国联通 China Unicom
中国广电 中国广电
方法二:手机号码前三位为192、176,180
方法三:telManager.getSimOperator()
中国电信 46011、46003、46005
中国移动 46000、46002、46004、46007、46008
中国联通 46001、46006、46009
中国广电 46015
中国铁通 46020
方法四:telManager.getSimOperatorName()
中国电信 中国电信
中国移动 CMCC
中国联通 UNICOM
中国广电 中国广电
其他情况请自行加入,原理是一样的
// 判断是否为广电卡
public static boolean phoneStart(String telephone,Context context){
// 方案一:手机号码开头为 192
if ("192".equals(telephone.substring(0,3))){
return true;
}
// 方案二:获取SIM运营商代码(MCC+MNC码:MCC:移动国家码,中国是460;MNC:移动网络码,00、 02是移动,01是联通,03是电信)
TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if ("46015".equals(telManager.getSimOperator())){
return true;
}
// 方案三:获取运营商的英文名
if ("中国广电".equals(telManager.getNetworkOperatorName())){
return true;
}
return false;
}