Example usage for android.telephony TelephonyManager SIM_STATE_PUK_REQUIRED

List of usage examples for android.telephony TelephonyManager SIM_STATE_PUK_REQUIRED

Introduction

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

Prototype

int SIM_STATE_PUK_REQUIRED

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

Click Source Link

Document

SIM card state: Locked: requires the user's SIM PUK 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. ja v  a  2s  .c o m*/
 */
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??//from w ww  . j a  v  a2  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;
    }
}