admin | 女足世界杯预测
首先我们需要知道手机IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。那么第一步就是先获取手机IMSI号码:代码如下
1 /**
2 *获取IMSI信息
3 * @param context
4 * @return
5 */
6 public static String getPhoneIMSI(Context context) {
7 TelephonyManager mTelephonyMgr = (TelephonyManager) context
8 .getSystemService(Context.TELEPHONY_SERVICE);
9 Log.v("LJC", "get getSubscriberId " + mTelephonyMgr.getSubscriberId());
10 return mTelephonyMgr.getSubscriberId();
11 }
或:
1 /**
2 * 检查是否电信手机卡
3 *
4 * @return 电信卡 返回true否则false
5 */
6 public boolean checkSIMCarl(Context context) {
7 boolean value = false;
8 String IMSI = getPhoneIMSI(context);
9 if (IMSI != null) {
10 if (IMSI.startsWith("46003"))
11 value = true;
12 }
13 return value;
14 // IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。其中
15 // if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
16 // ProvidersName = "中国移动";
17 // } else if (IMSI.startsWith("46001")) {
18 // ProvidersName ="中国联通";
19 // } else if (IMSI.startsWith("46003")) {
20 // ProvidersName = "中国电信";
21 }