Example usage for android.telephony TelephonyManager SIM_STATE_NETWORK_LOCKED

List of usage examples for android.telephony TelephonyManager SIM_STATE_NETWORK_LOCKED

Introduction

In this page you can find the example usage for android.telephony TelephonyManager SIM_STATE_NETWORK_LOCKED.

Prototype

int SIM_STATE_NETWORK_LOCKED

To view the source code for android.telephony TelephonyManager SIM_STATE_NETWORK_LOCKED.

Click Source Link

Document

SIM card state: Locked: requires a network PIN to unlock

Usage

From source file:Main.java

/**
 * Returns a constant indicating the state of the default SIM card.
 * @param sim_state "getSimState()"//from  w  w w  .  j a va 2s.c om
 */
public static String getSimStateStr(int sim_state) {
    switch (sim_state) {
    case TelephonyManager.SIM_STATE_UNKNOWN://0
        return "SIM_STATE_UNKNOWN";
    case TelephonyManager.SIM_STATE_ABSENT://1
        return "SIM_STATE_ABSENT";
    case TelephonyManager.SIM_STATE_PIN_REQUIRED://2
        return "SIM_STATE_PIN_REQUIRED";
    case TelephonyManager.SIM_STATE_PUK_REQUIRED://3
        return "SIM_STATE_PUK_REQUIRED";
    case TelephonyManager.SIM_STATE_NETWORK_LOCKED://4
        return "SIM_STATE_NETWORK_LOCKED";
    case TelephonyManager.SIM_STATE_READY://5
        return "SIM_STATE_READY";
    default:
        return UNKNOWN;
    }
}

From source file:com.polyvi.xface.extension.telephony.XTelephonyExt.java

/**
 * sim??/*  w w  w.j  ava2  s.  c  o  m*/
 *
 * @param tm
 * @return
 */
private boolean checkSimCardState(TelephonyManager tm) {
    int simState = tm.getSimState();
    switch (simState) {
    case TelephonyManager.SIM_STATE_ABSENT:
        return false;
    case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
        return true;
    case TelephonyManager.SIM_STATE_PIN_REQUIRED:
        return true;
    case TelephonyManager.SIM_STATE_PUK_REQUIRED:
        return true;
    case TelephonyManager.SIM_STATE_READY:
        return true;
    case TelephonyManager.SIM_STATE_UNKNOWN:
        return false;
    default:
        return false;
    }
}