In the previous article, we learned the Telephony class in android. provider. This article describes the classes in the android. telephony package. These classes are the APIs that android provides for upper-layer calls.
A series of Apis provided to monitor basic phone information. Such as the network type, connection status, and operating phone number tool class.
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + kernel/kernel + iwODQzaGj0rK/kernel + jrL/kernel + CjxwcmUgY2xhc3M9 "brush: java;"> Context. getSystemService (Context. TELEPHONY_SERVICE)To obtain the instance. To access protected information, you must configure the relevant permissions in the configuration file to access the information.
ConstantsACTION_PHONE_STATE_CHANGE: Send a broadcast intent when the call status changes. ACTION_RESPOND_VIA_MESSAGE
CALL_STATE_OFFHOOK: device status: Hanging CALL_STATE_RINGING: device status: Call DATA_ACTIVITY_DORMANT: The data connection is active, but the data connection is closed when the physical connection is closed. DATA_ACTIVITY_IN: The data connection is active, currently accept ip ppp traffic
DATA_ACTIVITY_INOUT: accept and send ip ppp traffic
DATA_ACTIVITY_NONE: The data connection is active, but there is no traffic. DATE_ACTIVITY_OUT: The data connection is in the connection status. The IP address PPP traffic is sent to DATA_CONNECTED: The data connection status is DATA_DISCONNECTED: data Connection disconnection data_su0000ded: Data Connection interruption EXTRA_INCOMING_NUMBER: the incoming call number included in the intent when the call status changes
EXTRA_STATE: Incoming call status NETWORK_TYPE_1xRTT: 2G network NETWORK_TYPE_CDMA: Code Division Multiple Access Protocol NETWORK_TYPE_EDGE: Enhanced Data Rate GSM Evolution technology, GSM transition to 3G protocol NETWORK_TYPE_EHRPD: CDMA transition to LTE protocol network_type_evdo: EVDO_0 network type direction: EVDO_A network type direction: EVDO_ B network type NETWORK_TYPE_GPRS: GRPS (Universal grouping wireless service technology) network type NETWORK_TYPE_HSDPA: HSDPA network type network_type_heat AP: High-Speed Downlink access, 3.5G) network type NETWORK_TYPE_HSUPA: HSUPA (High-Speed Uplink group access) network type NETWORK_TYPE_IDEN: IDEN (cluster communication system) network type NETWORK_TYPE_LTE: LTE (long-term evolution technology, UMTS pro Edition) network Type
NETWORK_TYPE_UMTS: UMTS (General Mobile Communication System) network type NETWORK_TYPE_UNKNOWN: Unknown network type PHONE_TYPE_CDMA: CDMA format mobile phone PHONE_TYPE_GSM: GSM format mobile phone PHONE_TYPE_NONE: No Mobile Phone RF PHONE_TYPE_SIP: SIM_STATE_ABSENT: SIM card status: unable to find SIM_STATE_NETWORK_LOCKED: SIM status: locked. You need a network PIN to unlock SIM_STATE_PIN_REQUIRED: SIM status: locked. You need a PIN to unlock SIM_STATE_PUK_REQUIRED: SIM card status: Locked, unlock the card
SIM_STATE_READY: SIM card status: Prepare (Ready) SIM_STATE_UNKNOWN: SIM card status: Unknown (Unknown)
Methods
List GetAllCellInfo ()
Get all the electricity dollar Information
Int getCallState ()
Current call status
CellLocation getCellLocation ()
Obtains the location of the current device.
Int getDataActivity ()
Activity Type in data connection
Int getDataState ()
Data Connection status
String getDeviceId ()
Device ID
String getDeviceSoftwareVersion ()
Software Version of the device
String getGroupIdLevel1 ()
GroupId level1 of the GSM mobile phone
String getLine1Number ()
Obtain the phone number of line 1, for example, MSISDN of a GSM mobile phone. Permission required: READ_PHONE_STATE.
String getMmsUAProfUrl ()
SMS Agent URL
String getMmsUserAgent ()
SMS agent
List GetNeighboringCellInfo ()
Obtain information about all neighboring cells
String getNetworkCountryIso ()
Country code MCC of the network operator
String getNetworkOperator ()
MCC + MNC code of the network registration Operator
String getNetworkOperatorName ()
Name of the Network Carrier
String getNetworkType ()
Network Type
String getPhoneType ()
Mobile phone type
String getSimCountryIso ()
Country Code provided by ISO
String getSimOperator ()
Obtain the 5-or 6-digit mobile Country Code MCC + mobile network code MNC of the SIM card
String getSimOperatorName ()
Get the name of the service provider
String getSimSerialNumber ()
Obtain the serial number of the sim.
String getSimState ()
SIM card status
String getSubscriberId ()
Unique User ID. Represents the user's identity, such as the IMSI Number of the GSM mobile phone
String getVoiceMailAlphaTag ()
Obtain the letter identifier related to the voicemail number. The permission READ_PHONE_STATE is required;
String getVoiceMailNumber ()
Get the voicemail number
Boolean hasIccCard ()
Contains ICC card?
Boolean isNetworkRoaming ()
Roaming?
Void listen (PhoneStateListenter, int)
Register a listener to receive notifications from the specified mobile phone when the status of the specified mobile phone changes.