Android obtains IMSI information (determined to be mobile, Unicom, and Telecom mobile phone cards) and androidimsi
First, we need to know that the first three digits of the mobile phone IMSI number are China Mobile, followed by two digits of 00 02, 01 is China Unicom, and 03 is China Telecom. The first step is to obtain the mobile phone IMSI number first: the code is as follows:
1/** 2 * Get IMSI Information 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}
Or:
1/** 2 * check whether the telecom phone card is 3*4 * @ return: return true; otherwise, 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 // the first three digits of IMSI are countries, followed by two digits of 00 02 are China Mobile, 01 is China Unicom and 03 is China Telecom. 15 // if (IMSI. startsWith ("46000") | IMSI. startsWith ("46002") {16 // ProvidersName = "China Mobile"; 17 //} else if (IMSI. startsWith ("46001") {18 // ProvidersName = "China Unicom"; 19 //} else if (IMSI. startsWith ("46003") {20 // ProvidersName = "China Telecom"; 21}