In the previous article, I learned about the telephony class in Android.provider. This article learns the classes in the Android.telephony package, which are the APIs that Android provides to the upper call.
A series of APIs for monitoring basic telephone information. For example, the network type, the connection status, the operation phone number of the tool class.
Altogether 25 classes. Here are the following:
Telephonymanager
Process telephony information on the device, which the app can use to detect the status of the phone and process the user's information type. You can also register a listener to accept notifications for phone status changes. The class cannot be instantiated directly and can be
Context.getsystemservice (Context.telephony_service)
To obtain the instance. If you want to access protected information, you need to configure the appropriate permissions in the configuration file to access it.
Constants
- Action_phone_state_change: sends a broadcast intent when the call state changes.
- Action_respond_via_message: When users use SMS to reject, send an intention to electrophoresis SMS app to send SMS
- Call_state_idle: Device status: No activity
- Call_state_offhook: Device status: Hanging off
- Call_state_ringing: Device Status: There is a phone call
- Data_activity_dormant: The data connection is active, but the physical connection is closed
- DATA_ACTIVITY_IN: Data connection active, currently accepting IP PPP traffic
- Data_activity_inout: Accept and send IP PPP traffic
- Data_activity_none: Data connection is active, but no traffic
- Date_activity_out: Data connection is connected, sending IP PPP traffic
- data_connected: Data Connection Status: connected
- Data_connecting: Data connection is being established
- data_disconnected: Data connection disconnected
- data_suspended: Data connection Interrupted
- Extra_incoming_number: Send the call phone number that is included in the intent when the calling status changes
- Extra_state: Incoming call status
- NETWORK_TYPE_1XRTT:2G Network
- NETWORK_TYPE_CDMA: Code Division Multiple Access Protocol (CDMA)
- 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_0:EVDO_0 Network Type
- Network_type_evdo_a:evdo_a Network Type
- Network_type_evdo_b:evdo_b Network Type
- Network_type_gprs:grps (General Packet Wireless Service technology) network type
- NETWORK_TYPE_HSDPA:HSDPA Network Type
- NETWORK_TYPE_HSPAP:HSPAP (High-speed downlink packet access, 3.5G) network type
- Network_type_hsupa:hsupa (High speed uplink packet access) network type
- Network_type_iden:iden (trunking communication system) network type
- Network_type_lte:lte (long-term evolution technology, the progressive version of UMTS) network type
- Network_type_umts:umts (Universal Mobile Communication System) network type
- Network_type_unknown: Unknown network type
- PHONE_TYPE_CDMA:CDMA formatted phone
- PHONE_TYPE_GSM:GSM formatted phone
- Phone_type_none: No Mobile Radio
- PHONE_TYPE_SIP: SIP-based phones
- Sim_state_absent:sim card status: not Found
- Sim_state_network_locked:sim status: Locked, requires network pin unlock
- Sim_state_pin_required:sim status: Locked, requires user PIN code to unlock
- Sim_state_puk_required:sim card Status: Lock, need unlock card to unlock
- Sim_state_ready:sim Card Status: Ready
- Sim_state_unknown:sim Card Status: Unknown (UNKNOWN)
Methods
List<cellinfo> Getallcellinfo ()
Get all the e-meta information
int Getcallstate ()
Current call status
Celllocation getcelllocation ()
Get the location of the current device
int getdataactivity ()
Types of activity in a data connection
int Getdatastate ()
Status of the data connection
String Getdeviceid ()
ID number of the device
String getdevicesoftwareversion ()
Software version of the device
String GetGroupIdLevel1 ()
GSM mobile phone's GroupID Level1
String Getline1number ()
Get the phone number for line Line 1, such as the msisdn of a GSM phone. Permission required: Read_phone_state.
String Getmmsuaprofurl ()
URL for SMS Agent
String getmmsuseragent ()
SMS Agent
List<neighboringcellinfo> Getneighboringcellinfo ()
Get all O-e meta information
String Getnetworkcountryiso ()
Network operator's country code MCC
String Getnetworkoperator ()
MCC+MNC Code of the network registration operator
String Getnetworkoperatorname ()
Name of the network operator
String Getnetworktype ()
Network type
String Getphonetype ()
Phone type
String Getsimcountryiso ()
Country code provided by ISO
String Getsimoperator ()
Get SIM card 5-bit or 6-bit mobile country code mcc+ mobile network Code MNC
String Getsimoperatorname ()
Get the name of the service provider
String Getsimserialnumber ()
Get the SIM string number
String Getsimstate ()
Get the status of the SIM card
String Getsubscriberid ()
Unique user identification ID. Represents the user's identity, such as the IMSI number of a GSM phone
String Getvoicemailalphatag ()
Obtaining the letter identifier associated with the voicemail number requires permission read_phone_state;
String Getvoicemailnumber ()
Get the voice mail number.
Boolean Hasicccard ()
Whether the ICC card is included
Boolean isnetworkroaming ()
Whether to roam
void Listen (Phonestatelistenter,int)
Register a listener to receive notifications from the phone when the specified phone status changes