java.lang.Object | ||
android.telephony.PhoneStateListener |
Class used to listen for changes in the phone state, including the service state, signal strength, message waiting (voicemail) indicator, etc.
Override the methods for the state that you wish to receive updates for, and pass your PhoneStateListener object, along with bitwise-or of the LISTEN_ flags to TelephonyManager.listen().
Value | ||||
---|---|---|---|---|
int | LISTEN_CALL_FORWARDING_INDICATOR | Listen for changes to the call forwarding indicator. | 8 | 0x00000008 |
int | LISTEN_CALL_STATE | Listen for changes to the call state. | 32 | 0x00000020 |
int | LISTEN_CELL_LOCATION | Listen for changes to the cell location. You probably don't want this method. You probably want to use the LocationManager. | 16 | 0x00000010 |
int | LISTEN_DATA_ACTIVITY | Listen for changes to the direction of data traffic. | 128 | 0x00000080 |
int | LISTEN_DATA_CONNECTION_STATE | Listen for changes to the data connection state. This is only for the phone radio, e.g. GPRS, EDGE, etc connection. | 64 | 0x00000040 |
int | LISTEN_MESSAGE_WAITING_INDICATOR | Listen for changes to the message waiting indicator. | 4 | 0x00000004 |
int | LISTEN_NONE | Stop listening for updates. | 0 | 0x00000000 |
int | LISTEN_SERVICE_STATE | Listen for changes to the service state. | 1 | 0x00000001 |
int | LISTEN_SIGNAL_STRENGTH | Listen for changes to the signal strength. | 2 | 0x00000002 |
PhoneStateListener() |
void | onCallForwardingIndicatorChanged(boolean cfi) | |||||
void | onCallStateChanged(int state, String incomingNumber) | |||||
void | onCellLocationChanged(CellLocation location) | |||||
void | onDataActivity(int direction) | |||||
void | onDataConnectionStateChanged(int state) | |||||
void | onMessageWaitingIndicatorChanged(boolean mwi) | |||||
void | onServiceStateChanged(ServiceState serviceState) | |||||
void | onSignalStrengthChanged(int asu) |
This requires the ACCESS_COARSE_LOCATION permission.
Pass this to TelephonyManager.listen() if you want to receive notifications via the onDataConnectionStateChanged(int) method.
This is what the status bar uses to turn on the icon when there is a voicemail waiting.
This is what the status bar uses to control the icon.
Copyright 2007 Google Inc. | Build 0.9_r1-98467 - 14 Aug 2008 18:56 |