Read SIM card information

public String readSIMCard() {
TelephonyManager tm = (TelephonyManager) this.getSystemService(TELEPHONY_SERVICE);//Get related system services
StringBuffer sb = new StringBuffer();
Switch(tm.getSimState()){ //getSimState() gets the state of sim. There are 6 states below.
Case TelephonyManager.SIM_STATE_ABSENT :sb.append("no card"); break;
Case TelephonyManager.SIM_STATE_UNKNOWN :sb.append("unknown state"); break;
Case TelephonyManager.SIM_STATE_NETWORK_LOCKED :sb.append("Requires NetworkPIN Unlock"); break;
Case TelephonyManager.SIM_STATE_PIN_REQUIRED : sb.append("requires PIN unlock"); break;
Case TelephonyManager.SIM_STATE_PUK_REQUIRED : sb.append("requires PUK unlock"); break;
Case TelephonyManager.SIM_STATE_READY :sb.append("good");break;
}

if(tm.getSimSerialNumber()!=null){
sb.append("@" + tm.getSimSerialNumber().toString());
}else{
Sb.append("@Unable to get SIM card number");
}

if(tm.getSimOperator().equals("")){
Sb.append("@Unable to get vendor code");
}else{
sb.append("@" + tm.getSimOperator().toString());
}

if(tm.getSimOperatorName().equals("")){
Sb.append("@ ");
}else{
sb.append("@" + tm.getSimOperatorName().toString());
}

if(tm.getSimCountryIso().equals("")){
Sb.append("@Unable to acquire nationality");
}else{
sb.append("@" + tm.getSimCountryIso().toString());
}

if (tm.getNetworkOperator().equals("")) {
Sb.append("@Unable to get network operator");
} else {
sb.append("@" + tm.getNetworkOperator());
}
if (tm.getNetworkOperatorName().equals("")) {
Sb.append("@Unable to get network operator name");
} else {
sb.append("@" + tm.getNetworkOperatorName());
}
if (tm.getNetworkType() == 0) {
Sb.append("@Unable to get network type");
} else {
sb.append("@" + tm.getNetworkType());
}
return sb.toString();
}

Intelligent Recommendation

All Android inquiry SIM card information

Query method:   The following is check out all the information: {     "NetworkTypeName":"UNKNOWN",     "PhoneId":0,  &nb...

Use TelephonyManager obtain network and SIM card information

TelephonyManager is an administrative phone call status, network information services like telephone, which provides a lot of getXxx () method to obtain information about the telephone network. To obt...

Android N SIM card information loading process

At PhoneAPP startup relationship class initializationIn, we mentioned the two key classes UiccController and IccCardProxy that monitor and process the status of the SIM card. So how do they interact w...

How to get SIM card linkage information

By querying the source code, ICCPROVIDER.JAVA complex SIMCARD data management. There is a data operation about the SIM Card Union....

More Recommendation

Android development - reflection to get dual card Sim card information

Refer to the blog of the predecessor: Directly package a tool class and record it Pass the TelephonyManager object to get the JSONArray data. My double card, the returned data is as follows (desensiti...

A——Sim Card

A(1259): Sim Card Submit Page    Time Limit: 3 Sec     Memory Limit: 512 Mb     Submitted: 35   &nbs...

SIM card

How to implement SIM function with development board Directory name How to implement SIM function with development board Introduction API description Example common problem Related information and pur...

Android base station information acquisition and Sim card related information acquisition

Overview: This article mainly introduces the way Android obtains the information of the base station. In addition, there are also related fields of SIM card acquisition. First introduce some concepts ...

How to get contact information of mobile phone and sim card on Android

The demand is very clear, get the contact information of the phone and sim. Interface design is also very brief The data is designed as: Break down, here are three questions to solve: How to get phone...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top