|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.telephony.PhoneStateListener
public class PhoneStateListener
A listener class for monitoring changes in specific telephony states on the device, including service state, signal strength, message waiting indicator (voicemail), and others.
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().
Note that access to some telephony information is permission-protected. Your application won't receive updates for protected information unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the appropriate LISTEN_ flags.
| Field Summary | |
|---|---|
(package private) IPhoneStateListener |
callback
The callback methods need to be called on the handler thread where this object was created. |
static int |
LISTEN_CALL_FORWARDING_INDICATOR
Listen for changes to the call-forwarding indicator. |
static int |
LISTEN_CALL_STATE
Listen for changes to the device call state. |
static int |
LISTEN_CELL_LOCATION
Listen for changes to the device's cell location. |
static int |
LISTEN_DATA_ACTIVITY
Listen for changes to the direction of data traffic on the data connection (cellular). |
static int |
LISTEN_DATA_CONNECTION_STATE
Listen for changes to the data connection state (cellular). |
static int |
LISTEN_MESSAGE_WAITING_INDICATOR
Listen for changes to the message-waiting indicator. |
static int |
LISTEN_NONE
Stop listening for updates. |
static int |
LISTEN_SERVICE_STATE
Listen for changes to the network service state (cellular). |
static int |
LISTEN_SIGNAL_STRENGTH
Listen for changes to the network signal strength (cellular). |
(package private) Handler |
mHandler
|
| Constructor Summary | |
|---|---|
PhoneStateListener()
|
|
| Method Summary | |
|---|---|
void |
onCallForwardingIndicatorChanged(boolean cfi)
Callback invoked when the call-forwarding indicator changes. |
void |
onCallStateChanged(int state,
String incomingNumber)
Callback invoked when device call state changes. |
void |
onCellLocationChanged(CellLocation location)
Callback invoked when device cell location changes. |
void |
onDataActivity(int direction)
Callback invoked when data activity state changes. |
void |
onDataConnectionStateChanged(int state)
Callback invoked when connection state changes. |
void |
onMessageWaitingIndicatorChanged(boolean mwi)
Callback invoked when the message-waiting indicator changes. |
void |
onServiceStateChanged(ServiceState serviceState)
Callback invoked when device service state changes. |
void |
onSignalStrengthChanged(int asu)
Callback invoked when network signal strength changes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LISTEN_NONE
public static final int LISTEN_SERVICE_STATE
onServiceStateChanged(android.telephony.ServiceState),
ServiceState,
Constant Field Valuespublic static final int LISTEN_SIGNAL_STRENGTH
Example: The status bar uses this to control the signal-strength icon.
onSignalStrengthChanged(int),
Constant Field Valuespublic static final int LISTEN_MESSAGE_WAITING_INDICATOR
Example: The status bar uses this to determine when to display the voicemail icon.
onMessageWaitingIndicatorChanged(boolean),
Constant Field Valuespublic static final int LISTEN_CALL_FORWARDING_INDICATOR
onCallForwardingIndicatorChanged(boolean),
Constant Field Valuespublic static final int LISTEN_CELL_LOCATION
ACCESS_COARSE_LOCATION
If you need regular location updates but want more control over
the update interval or location precision, you can set up a listener
through the location manager
instead.
onCellLocationChanged(android.telephony.CellLocation),
Constant Field Valuespublic static final int LISTEN_CALL_STATE
onCallStateChanged(int, java.lang.String),
Constant Field Valuespublic static final int LISTEN_DATA_CONNECTION_STATE
onDataConnectionStateChanged(int),
Constant Field Valuespublic static final int LISTEN_DATA_ACTIVITY
onDataActivity(int),
Constant Field ValuesIPhoneStateListener callback
Handler mHandler
| Constructor Detail |
|---|
public PhoneStateListener()
| Method Detail |
|---|
public void onServiceStateChanged(ServiceState serviceState)
ServiceState.STATE_EMERGENCY_ONLY,
ServiceState.STATE_IN_SERVICE,
ServiceState.STATE_OUT_OF_SERVICE,
ServiceState.STATE_POWER_OFFpublic void onSignalStrengthChanged(int asu)
ServiceState.STATE_EMERGENCY_ONLY,
ServiceState.STATE_IN_SERVICE,
ServiceState.STATE_OUT_OF_SERVICE,
ServiceState.STATE_POWER_OFFpublic void onMessageWaitingIndicatorChanged(boolean mwi)
public void onCallForwardingIndicatorChanged(boolean cfi)
public void onCellLocationChanged(CellLocation location)
public void onCallStateChanged(int state,
String incomingNumber)
TelephonyManager.CALL_STATE_IDLE,
TelephonyManager.CALL_STATE_RINGING,
TelephonyManager.CALL_STATE_OFFHOOKpublic void onDataConnectionStateChanged(int state)
TelephonyManager.DATA_DISCONNECTED,
TelephonyManager.DATA_CONNECTING,
TelephonyManager.DATA_CONNECTED,
TelephonyManager.DATA_SUSPENDEDpublic void onDataActivity(int direction)
TelephonyManager.DATA_ACTIVITY_NONE,
TelephonyManager.DATA_ACTIVITY_IN,
TelephonyManager.DATA_ACTIVITY_OUT,
TelephonyManager.DATA_ACTIVITY_INOUT
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||