Telephony Learning Notes from Android (2)

Source: Internet
Author: User

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. such as network type, connection status. The tool class that operates the phone number.




Altogether 25 classes. The following describes each:


Telephonymanager


Processing the telephony information on the device, the application can use these methods to detect the status of the phone, processing the user's information type. It is also possible to register a listener to receive notification of changes in phone status. The class cannot be instantiated directly and is capable of

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.


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 a 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 (Fast downlink packet Access, 3.5G) network type
  • Network_type_hsupa:hsupa (Fast 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: Lock, need network pin to unlock
  • Sim_state_pin_required:sim status: Locked. User PIN code required to unlock
  • Sim_state_puk_required:sim card status: Locked. 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 electrical element 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 number 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. Need permission: 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 for Network Register operators


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 a user's identity, such as the IMSI number of a GSM phone


String Getvoicemailalphatag ()


To get the letter identifier associated with the voicemail number, the permission read_phone_state is required;


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









Telephony Learning Notes from Android (2)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.