Android determines which mobile operator the SIM card belongs to, androidsim
Method 1:
Obtain the IMSI code of the mobile phone and determine whether it is China Mobile, China Unicom, or China Telecom.
TelephonyManager telManager = (TelephonyManager) getSystemService (Context. TELEPHONY_SERVICE);/** get the IMSI code of the SIM card * unique ID of the SIM card: IMSI International Mobile User Identification code (IMSI: International Mobile Subscriber Identification Number) is the identifier that distinguishes Mobile users, * It is stored in the SIM card and can be used to distinguish valid information of mobile users. IMSI consists of MCC, MNC, and MSIN. Among them, MCC is a mobile country number consisting of three digits. * It uniquely identifies the country to which mobile customers belong, and China is 460; MNC is a network id consisting of two digits. * It is used to identify the mobile network to which a mobile customer belongs. China Mobile is 00, China Unicom is 01, and China Telecom is 03; MSIN is a mobile customer identification code consisting of 11 digits. * Uniquely identifies China Mobile clients in the domestic GSM mobile communication network. To distinguish between mobile and Unicom, you only need to obtain the MNC field in the SIM card */String imsi = telManager. getSubscriberId (); if (imsi! = Null) {if (imsi. startsWith ("46000") | imsi. startsWith ("46002") {// because IMSI under mobile network number 46000 is used up, A 46002 number is virtualized, section 134/159 uses this ID // China Mobile} else if (imsi. startsWith ("46001") {// China Unicom} else if (imsi. startsWith ("46003") {// China Telecom }}
Method 2
TelephonyManager telManager = (TelephonyManager) getSystemService (Context. TELEPHONY_SERVICE); String operator = telManager. getSimOperator (); if (operator! = Null) {if (operator. equals ("46000") | operator. equals ("46002") {// China Mobile} else if (operator. equals ("46001") {// China Unicom} else if (operator. equals ("46003") {// China Telecom }}