Android determines the operator of the mobile phone number
TextView TV = (TextView) findViewById (R. id. TV); TelephonyManager telManager = (TelephonyManager) getSystemService (Context. TELEPHONY_SERVICE); // get the IMSI code of the SIM card String imsi = telManager. getSubscriberId (); // MNC 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, and segment 134/159 uses this number/China Mobile TV. setText (imsi + "China Mobile");} else if (imsi. startsWith ("46001") {// China Unicom TV. setText (imsi + "China Unicom");} else if (imsi. startsWith ("46003") {// China Telecom TV. setText (imsi + "China Telecom ");}}
Note: add permissions to Manifest. xml:
TelephonyManager telManager = (TelephonyManager) getSystemService (Context. TELEPHONY_SERVICE); String operator = telManager. getSimOperator (); TextView TV = (TextView) findViewById (R. id. TV); if (operator! = Null) {if (operator. equals ("46000") | operator. equals ("46002") | operator. equals ("46007") {// China Mobile TV. setText ("China Mobile");} else if (operator. equals ("46001") {// China Unicom TV. setText ("China Unicom");} else if (operator. equals ("46003") {// China Telecom TV. setText ("China Telecom ");
Note: add permissions to Manifest. xml: