Android
android.telephony
public class

android.telephony.TelephonyManager

java.lang.Object
android.telephony.TelephonyManager

Access the state of the phone radio.

Summary

Constants

      Value  
int  CALL_STATE_IDLE    0x00000000 
int  CALL_STATE_OFFHOOK    0x00000002 
int  CALL_STATE_RINGING    0x00000001 
int  DATA_ACTIVITY_IN    0x00000001 
int  DATA_ACTIVITY_INOUT    0x00000003 
int  DATA_ACTIVITY_NONE    0x00000000 
int  DATA_ACTIVITY_OUT    0x00000002 
int  DATA_CONNECTED    0x00000002 
int  DATA_CONNECTING    0x00000001 
int  DATA_DISCONNECTED    0x00000000 
int  DATA_SUSPENDED    0x00000003 
int  NETWORK_TYPE_EDGE    0x00000002 
int  NETWORK_TYPE_GPRS    0x00000001 
int  NETWORK_TYPE_UMTS    0x00000003 
int  NETWORK_TYPE_UNKNOWN    0x00000000 
int  PHONE_TYPE_GSM  This is a GSM phone.  0x00000001 
int  PHONE_TYPE_NONE  This device does not have a phone module.  0x00000000 
int  SIM_STATE_ABSENT    0x00000001 
int  SIM_STATE_NETWORK_LOCKED    0x00000004 
int  SIM_STATE_PIN_REQUIRED    0x00000002 
int  SIM_STATE_PUK_REQUIRED    0x00000003 
int  SIM_STATE_READY    0x00000005 
int  SIM_STATE_UNKNOWN    0x00000000 

Public Methods

          int  getCallState()
          CellLocation  getCellLocation()
Retrieves the current location of the device.
          int  getDataActivity()
Get the data activity state.
          int  getDataState()
          String  getDeviceId()
Retrieves the unique device ID, e.g., IMEI for GSM phones.
          String  getDeviceSoftwareVersion()
Retrieves the software version number for the device, e.g., IMEI/SV for GSM phones.
          String  getLine1Number()
Retrieves the phone number string for line 1.
          String  getNetworkCountryIso()
The ISO country code equivilent of the current registered operator's MCC (Mobile Country Code) Availability: when registered to a network
          String  getNetworkOperator()
Numeric name (MCC+MNC) of current registered operator.
          String  getNetworkOperatorName()
Alpha name of current registered operator.
          int  getNetworkType()
Indicates the available radio technology.
          int  getPhoneType()
Returns PHONE_TYPE_NONE or PHONE_TYPE_GSM.
          String  getSimCountryIso()
ISO country code equivalent for the SIM provider's country code
          String  getSimOperator()
The MCC+MNC (mobile country code+mobile network code) of the provider of the SIM.
          String  getSimOperatorName()
Also known as the SPN, or Service Provider Name.
          String  getSimSerialNumber()
Retrieves the serial number of the SIM, if applicable.
          int  getSimState()
Returns the state of the SIM.
          String  getSubscriberId()
Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
          String  getVoiceMailAlphaTag()
Retrieves the voice mail alpha identifier.
          String  getVoiceMailNumber()
Retrieves the voice mail number.
          boolean  isNetworkRoaming()
Returns whether the device is considered roaming on this network for GSM purposes.
          void  listen(PhoneStateListener listener, int events)
Listen for chagnes in the phone state.
Methods inherited from class java.lang.Object

Details

Constants

public static final int CALL_STATE_IDLE

Constant Value: 0 (0x00000000)

public static final int CALL_STATE_OFFHOOK

Constant Value: 2 (0x00000002)

public static final int CALL_STATE_RINGING

Constant Value: 1 (0x00000001)

public static final int DATA_ACTIVITY_IN

Constant Value: 1 (0x00000001)

public static final int DATA_ACTIVITY_INOUT

Constant Value: 3 (0x00000003)

public static final int DATA_ACTIVITY_NONE

Constant Value: 0 (0x00000000)

public static final int DATA_ACTIVITY_OUT

Constant Value: 2 (0x00000002)

public static final int DATA_CONNECTED

Constant Value: 2 (0x00000002)

public static final int DATA_CONNECTING

Constant Value: 1 (0x00000001)

public static final int DATA_DISCONNECTED

Constant Value: 0 (0x00000000)

public static final int DATA_SUSPENDED

Constant Value: 3 (0x00000003)

public static final int NETWORK_TYPE_EDGE

Constant Value: 2 (0x00000002)

public static final int NETWORK_TYPE_GPRS

Constant Value: 1 (0x00000001)

public static final int NETWORK_TYPE_UMTS

Constant Value: 3 (0x00000003)

public static final int NETWORK_TYPE_UNKNOWN

Constant Value: 0 (0x00000000)

public static final int PHONE_TYPE_GSM

This is a GSM phone.
Constant Value: 1 (0x00000001)

public static final int PHONE_TYPE_NONE

This device does not have a phone module.
Constant Value: 0 (0x00000000)

public static final int SIM_STATE_ABSENT

Constant Value: 1 (0x00000001)

public static final int SIM_STATE_NETWORK_LOCKED

Constant Value: 4 (0x00000004)

public static final int SIM_STATE_PIN_REQUIRED

Constant Value: 2 (0x00000002)

public static final int SIM_STATE_PUK_REQUIRED

Constant Value: 3 (0x00000003)

public static final int SIM_STATE_READY

Constant Value: 5 (0x00000005)

public static final int SIM_STATE_UNKNOWN

Constant Value: 0 (0x00000000)

Public Methods

public int getCallState()

public CellLocation getCellLocation()

Retrieves the current location of the device.

This requires the ACCESS_COARSE_LOCATION permission.

public int getDataActivity()

public int getDataState()

public String getDeviceId()

Retrieves the unique device ID, e.g., IMEI for GSM phones.

public String getDeviceSoftwareVersion()

Retrieves the software version number for the device, e.g., IMEI/SV for GSM phones.

public String getLine1Number()

Retrieves the phone number string for line 1.

public String getNetworkCountryIso()

The ISO country code equivilent of the current registered operator's MCC (Mobile Country Code) Availability: when registered to a network

public String getNetworkOperator()

Numeric name (MCC+MNC) of current registered operator. Availability: when registered to a network

public String getNetworkOperatorName()

Alpha name of current registered operator. Availability: when registered to a network

public int getNetworkType()

Indicates the available radio technology.

public int getPhoneType()

public String getSimCountryIso()

ISO country code equivalent for the SIM provider's country code

public String getSimOperator()

The MCC+MNC (mobile country code+mobile network code) of the provider of the SIM. 5 or 6 decimal digits. Availablity: SIM state must be "READY"

public String getSimOperatorName()

Also known as the SPN, or Service Provider Name. Availablity: SIM state must be "READY"

public String getSimSerialNumber()

Retrieves the serial number of the SIM, if applicable.

public String getSubscriberId()

Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.

public String getVoiceMailAlphaTag()

Retrieves the voice mail alpha identifier.

public String getVoiceMailNumber()

Retrieves the voice mail number.

public boolean isNetworkRoaming()

Returns whether the device is considered roaming on this network for GSM purposes. Availability: when registered to a network

public void listen(PhoneStateListener listener, int events)

Listen for chagnes in the phone state.

Only changes for the states listeted in the events parameter will be sent. Upon registration, the callback will be called with the current value.

To stop listening for a given listener, pass PhoneStateListener.LISTEN_NONE (0) as the events argument.

Parameters

listener The PhoneStateListener object to call back on when state changes.
events The bitwise-or of the LISTEN_ flags on PhoneStateListener for the events to listen to.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56