Android TelephonyManager 参数定义和功能 API 介绍
简介
TelephonyManager 是 Android 提供的一个类,主要用于处理与设备的电信网络相关的信息。它允许开发者访问有关电话状态、SIM 卡信息、网络连接状态等多个方面的功能。
参数定义
SIM状态 SIM_STATE_XXX
- SIM_STATE_UNKNOWN,
- SIM_STATE_ABSENT,
- SIM_STATE_PIN_REQUIRED,
- SIM_STATE_PUK_REQUIRED,
- SIM_STATE_NETWORK_LOCKED,
- SIM_STATE_READY,
- SIM_STATE_NOT_READY,
- SIM_STATE_PERM_DISABLED,
- SIM_STATE_CARD_IO_ERROR,
- SIM_STATE_CARD_RESTRICTED,
- SIM_STATE_LOADED,
- SIM_STATE_PRESENT,
TelephonyManager.java - OpenGrok cross reference for /frameworks/base/telephony/java/android/telephony/TelephonyManager.java
//
//
// SIM Card
//
//
/** @hide */
@IntDef(prefix = {"SIM_STATE_"},
value = {
SIM_STATE_UNKNOWN,
SIM_STATE_ABSENT,
SIM_STATE_PIN_REQUIRED,
SIM_STATE_PUK_REQUIRED,
SIM_STATE_NETWORK_LOCKED,
SIM_STATE_READY,
SIM_STATE_NOT_READY,
SIM_STATE_PERM_DISABLED,
SIM_STATE_CARD_IO_ERROR,
SIM_STATE_CARD_RESTRICTED,
SIM_STATE_LOADED,
SIM_STATE_PRESENT,
})
public @interface SimState {}
/**
* SIM card state: Unknown. Signifies that the SIM is in transition
* between states. For example, when the user inputs the SIM pin
* under PIN_REQUIRED state, a query for sim status returns
* this state before turning to SIM_STATE_READY.
*
* These are the ordinal value of IccCardConstants.State.
*/
public static final int SIM_STATE_UNKNOWN = TelephonyProtoEnums.SIM_STATE_UNKNOWN; // 0
/** SIM card state: no SIM card is available in the device */
public static final int SIM_STATE_ABSENT = TelephonyProtoEnums.SIM_STATE_ABSENT; // 1
/** SIM card state: Locked: requires the user's SIM PIN to unlock */
public static final int SIM_STATE_PIN_REQUIRED =
TelephonyProtoEnums.SIM_STATE_PIN_REQUIRED; // 2
/** SIM card state: Locked: requires the user's SIM PUK to unlock */
public static final int SIM_STATE_PUK_REQUIRED =
TelephonyProtoEnums.SIM_STATE_PUK_REQUIRED; // 3
/** SIM card state: Locked: requires a network PIN to unlock */
public static final int SIM_STATE_NETWORK_LOCKED =
TelephonyProtoEnums.SIM_STATE_NETWORK_LOCKED; // 4
/** SIM card state: Ready */
public static final int SIM_STATE_READY = TelephonyProtoEnums.SIM_STATE_READY; // 5
/** SIM card state: SIM Card is NOT READY */
public static final int SIM_STATE_NOT_READY = TelephonyProtoEnums.SIM_STATE_NOT_READY; // 6
/** SIM card state: SIM Card Error, permanently disabled */
public static final int SIM_STATE_PERM_DISABLED =
TelephonyProtoEnums.SIM_STATE_PERM_DISABLED; // 7
/** SIM card state: SIM Card Error, present but faulty */
public static final int SIM_STATE_CARD_IO_ERROR =
TelephonyProtoEnums.SIM_STATE_CARD_IO_ERROR; // 8
/** SIM card state: SIM Card restricted, present but not usable due to
* carrier restrictions.
*/
public static final int SIM_STATE_CARD_RESTRICTED =
TelephonyProtoEnums.SIM_STATE_CARD_RESTRICTED; // 9
/**
* SIM card state: Loaded: SIM card applications have been loaded
* @hide
*/
@SystemApi
public static final int SIM_STATE_LOADED = TelephonyProtoEnums.SIM_STATE_LOADED; // 10
/**
* SIM card state: SIM Card is present
* @hide
*/
@SystemApi
public static final int SIM_STATE_PRESENT = TelephonyProtoEnums.SIM_STATE_PRESENT; // 11
/**
* Extra included in {@link #ACTION_SIM_CARD_STATE_CHANGED} and
* {@link #ACTION_SIM_APPLICATION_STATE_CHANGED} to indicate the card/application state.
*
* @hide
*/
@SystemApi
public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
/**
* Broadcast Action: The sim card state has changed.
* The intent will have the following extra values:</p>
* <dl>
* <dt>{@link #EXTRA_SIM_STATE}</dt>
* <dd>The sim card state. One of:
* <dl>
* <dt>{@link #SIM_STATE_ABSENT}</dt>
* <dd>SIM card not found</dd>
* <dt>{@link #SIM_STATE_CARD_IO_ERROR}</dt>
* <dd>SIM card IO error</dd>
* <dt>{@link #SIM_STATE_CARD_RESTRICTED}</dt>
* <dd>SIM card is restricted</dd>
* <dt>{@link #SIM_STATE_PRESENT}</dt>
* <dd>SIM card is present</dd>
* </dl>
* </dd>
* </dl>
*
* <p class="note">Requires the READ_PRIVILEGED_PHONE_STATE permission.
*
* <p class="note">The current state can also be queried using {@link #getSimCardState()}.
*
* <p class="note">This is a protected intent that can only be sent by the system.
* @hide
*/
@SystemApi
@SdkConstant(SdkConsta