PhoneStateListener
  public
  
  
  
  class
  PhoneStateListener
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.telephony.PhoneStateListener | 
      This class was deprecated
      in API level 31.
    Use TelephonyCallback instead.
  
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(). Methods are
 called when the state changes, as well as once on initial registration.
 
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.
Summary
| Public constructors | |
|---|---|
| 
      PhoneStateListener()
      Create a PhoneStateListener for the Phone with the default subscription. | |
| 
      PhoneStateListener(Executor executor)
      Create a PhoneStateListener for the Phone using the specified Executor Create a PhoneStateListener with a specified Executor for handling necessary callbacks. | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      onActiveDataSubscriptionIdChanged(int subId)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onBarringInfoChanged(BarringInfo barringInfo)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onCallDisconnectCauseChanged(int disconnectCause, int preciseDisconnectCause)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onCallForwardingIndicatorChanged(boolean cfi)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onCallStateChanged(int state, String phoneNumber)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onCellInfoChanged(List<CellInfo> cellInfo)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onCellLocationChanged(CellLocation location)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onDataActivity(int direction)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onDataConnectionStateChanged(int state, int networkType)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onDataConnectionStateChanged(int state)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onEmergencyNumberListChanged(Map<Integer, List<EmergencyNumber>> emergencyNumberList)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onImsCallDisconnectCauseChanged(ImsReasonInfo imsReasonInfo)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onMessageWaitingIndicatorChanged(boolean mwi)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onPreciseDataConnectionStateChanged(PreciseDataConnectionState dataConnectionState)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onRegistrationFailed(CellIdentity cellIdentity, String chosenPlmn, int domain, int causeCode, int additionalCauseCode)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onServiceStateChanged(ServiceState serviceState)
      
      This method is deprecated.
    Use  | 
| 
        
        
        
        
        
        void | 
      onSignalStrengthChanged(int asu)
      
      This method was deprecated
      in API level 15.
    Use  | 
| 
        
        
        
        
        
        void | 
      onSignalStrengthsChanged(SignalStrength signalStrength)
      
      This method was deprecated
      in API level 31.
    Use  | 
| 
        
        
        
        
        
        void | 
      onUserMobileDataStateChanged(boolean enabled)
      
      This method was deprecated
      in API level 31.
    Use  | 
| Inherited methods | |
|---|---|
Constants
LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE
public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.ActiveDataSubscriptionIdListener instead.
  
Listen for changes to active data subId. Active data subscription is
  the current subscription used to setup Cellular Internet data. For example,
  it could be the current active opportunistic subscription in use, or the
  subscription user selected as default data subscription in DSDS mode.
 
 Requires Manifest.permission.READ_PHONE_STATE
See also:
Constant Value: 4194304 (0x00400000)
LISTEN_BARRING_INFO
public static final int LISTEN_BARRING_INFO
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.BarringInfoListener instead.
  
Listen for Barring Information for the current registered / camped cell.
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE or
 the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges).
 
Also requires the Manifest.permission.ACCESS_FINE_LOCATION permission, regardless
 of whether the calling app has carrier privileges.
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
See also:
Constant Value: -2147483648 (0x80000000)
LISTEN_CALL_DISCONNECT_CAUSES
public static final int LISTEN_CALL_DISCONNECT_CAUSES
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.CallDisconnectCauseListener instead.
  
Listen for call disconnect causes which contains DisconnectCause and
 the precise disconnect cause.
 
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE
 or the calling app has carrier privileges
 (see TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
Constant Value: 33554432 (0x02000000)
LISTEN_CALL_FORWARDING_INDICATOR
public static final int LISTEN_CALL_FORWARDING_INDICATOR
      This constant is deprecated.
    Use TelephonyCallback.CallForwardingIndicatorListener instead.
  
Listen for changes to the call-forwarding indicator.
 Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see
 TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PHONE_STATE
Constant Value: 8 (0x00000008)
LISTEN_CALL_STATE
public static final int LISTEN_CALL_STATE
      This constant is deprecated.
    Use TelephonyCallback.CallStateListener instead.
  
Listen for changes to the device call state.
See also:
Constant Value: 32 (0x00000020)
LISTEN_CELL_INFO
public static final int LISTEN_CELL_INFO
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.CellInfoListener instead.
  
Listen for changes to observed cell info.
 Listening to this event requires the Manifest.permission.READ_PHONE_STATE and
 Manifest.permission.ACCESS_FINE_LOCATION
 permission.
 
 Requires Manifest.permission.READ_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
See also:
Constant Value: 1024 (0x00000400)
LISTEN_CELL_LOCATION
public static final int LISTEN_CELL_LOCATION
      This constant is deprecated.
    Use TelephonyCallback.CellLocationListener instead.
  
Listen for changes to the device's cell location. Note that this will result in frequent callbacks to the listener.
 Requires Permission: ACCESS_FINE_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.
 
 Requires Manifest.permission.ACCESS_FINE_LOCATION
See also:
Constant Value: 16 (0x00000010)
LISTEN_DATA_ACTIVITY
public static final int LISTEN_DATA_ACTIVITY
      This constant is deprecated.
    Use TelephonyCallback.DataActivityListener instead.
  
Listen for changes to the direction of data traffic on the data connection (cellular).
Example: The status bar uses this to display the appropriate data-traffic icon.
See also:
Constant Value: 128 (0x00000080)
LISTEN_DATA_CONNECTION_STATE
public static final int LISTEN_DATA_CONNECTION_STATE
      This constant is deprecated.
    Use TelephonyCallback.DataConnectionStateListener instead.
  
Listen for changes to the data connection state (cellular).
See also:
Constant Value: 64 (0x00000040)
LISTEN_DISPLAY_INFO_CHANGED
public static final int LISTEN_DISPLAY_INFO_CHANGED
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.DisplayInfoListener instead.
  
Listen for display info changed event.
 For clients compiled on Android 11 SDK, requires permission:
 Manifest.permission.READ_PHONE_STATE or that the calling app has carrier
 privileges (see TelephonyManager.hasCarrierPrivileges).
 For clients compiled on Android 12 SDK or newer,
 Manifest.permission.READ_PHONE_STATE or carrier privileges is not required
 anymore.
Constant Value: 1048576 (0x00100000)
LISTEN_EMERGENCY_NUMBER_LIST
public static final int LISTEN_EMERGENCY_NUMBER_LIST
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.EmergencyNumberListListener instead.
  
Listen for changes to emergency number list based on all active subscriptions.
Requires permission Manifest.permission.READ_PHONE_STATE or the calling
 app has carrier privileges (see TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PHONE_STATE
Constant Value: 16777216 (0x01000000)
LISTEN_IMS_CALL_DISCONNECT_CAUSES
public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.ImsCallDisconnectCauseListener instead.
  
Listen for IMS call disconnect causes which contains
 ImsReasonInfo
 
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE
 or the calling app has carrier privileges
 (see TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
Constant Value: 134217728 (0x08000000)
LISTEN_MESSAGE_WAITING_INDICATOR
public static final int LISTEN_MESSAGE_WAITING_INDICATOR
      This constant is deprecated.
    Use TelephonyCallback.MessageWaitingIndicatorListener instead.
  
Listen for changes to the message-waiting indicator.
 Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see
 TelephonyManager.hasCarrierPrivileges).
 
 Example: The status bar uses this to determine when to display the
 voicemail icon.
 
 Requires Manifest.permission.READ_PHONE_STATE
Constant Value: 4 (0x00000004)
LISTEN_NONE
public static final int LISTEN_NONE
Stop listening for updates. The PhoneStateListener is not tied to any subscription and unregistered for any update.
Constant Value: 0 (0x00000000)
LISTEN_PRECISE_DATA_CONNECTION_STATE
public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.PreciseDataConnectionStateListener instead.
  
Listen for PreciseDataConnectionState on the data connection (cellular).
 
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE
 or the calling app has carrier privileges
 (see TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
Constant Value: 4096 (0x00001000)
LISTEN_REGISTRATION_FAILURE
public static final int LISTEN_REGISTRATION_FAILURE
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.RegistrationFailedListener instead.
  
Listen for Registration Failures.
 Listen for indications that a registration procedure has failed in either the CS or PS
 domain. This indication does not necessarily indicate a change of service state, which should
 be tracked via LISTEN_SERVICE_STATE.
 
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE or
 the calling app has carrier privileges (see TelephonyManager.hasCarrierPrivileges).
 
Also requires the Manifest.permission.ACCESS_FINE_LOCATION permission, regardless
 of whether the calling app has carrier privileges.
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
Constant Value: 1073741824 (0x40000000)
LISTEN_SERVICE_STATE
public static final int LISTEN_SERVICE_STATE
      This constant is deprecated.
    Use TelephonyCallback.ServiceStateListener instead.
  
Listen for changes to the network service state (cellular).
Constant Value: 1 (0x00000001)
LISTEN_SIGNAL_STRENGTH
public static final int LISTEN_SIGNAL_STRENGTH
      This constant was deprecated
      in API level 15.
    Use TelephonyCallback.SignalStrengthsListener instead.
  
Listen for changes to the network signal strength (cellular).
See also:
Constant Value: 2 (0x00000002)
LISTEN_SIGNAL_STRENGTHS
public static final int LISTEN_SIGNAL_STRENGTHS
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.SignalStrengthsListener instead.
  
Listen for changes to the network signal strengths (cellular).
Example: The status bar uses this to control the signal-strength icon.
See also:
Constant Value: 256 (0x00000100)
LISTEN_USER_MOBILE_DATA_STATE
public static final int LISTEN_USER_MOBILE_DATA_STATE
      This constant was deprecated
      in API level 31.
    Use TelephonyCallback.UserMobileDataStateListener instead.
  
Listen for changes to the user mobile data state
See also:
Constant Value: 524288 (0x00080000)
Public constructors
PhoneStateListener
public PhoneStateListener ()
Create a PhoneStateListener for the Phone with the default subscription. This class requires Looper.myLooper() not return null.
PhoneStateListener
public PhoneStateListener (Executor executor)
Create a PhoneStateListener for the Phone using the specified Executor
Create a PhoneStateListener with a specified Executor for handling necessary callbacks. The Executor must not be null.
| Parameters | |
|---|---|
| executor | Executor: a non-null Executor that will execute callbacks for the PhoneStateListener. | 
Public methods
onActiveDataSubscriptionIdChanged
public void onActiveDataSubscriptionIdChanged (int subId)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.ActiveDataSubscriptionIdListener instead.
  
Callback invoked when active data subId changes.
 Note, this callback triggers regardless of registered subscription.
 Requires the READ_PHONE_STATE permission.
 
 Requires Manifest.permission.READ_PHONE_STATE
| Parameters | |
|---|---|
| subId | int: current subscription used to setup Cellular Internet data.
              For example, it could be the current active opportunistic subscription in use,
              or the subscription user selected as default data subscription in DSDS mode. | 
onBarringInfoChanged
public void onBarringInfoChanged (BarringInfo barringInfo)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.BarringInfoListener instead.
  
Report updated barring information for the current camped/registered cell.
Barring info is provided for all services applicable to the current camped/registered
 cell, for the registered PLMN and current access class/access category.
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
| Parameters | |
|---|---|
| barringInfo | BarringInfo: for all services on the current cell.
 This value cannot benull. | 
See also:
onCallDisconnectCauseChanged
public void onCallDisconnectCauseChanged (int disconnectCause, 
                int preciseDisconnectCause)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.CallDisconnectCauseListener instead.
  
Callback invoked when call disconnect cause changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
| Parameters | |
|---|---|
| disconnectCause | int: the disconnect cause
 Value isDisconnectCause.NOT_VALID,DisconnectCause.NOT_DISCONNECTED,DisconnectCause.INCOMING_MISSED,DisconnectCause.NORMAL,DisconnectCause.LOCAL,DisconnectCause.BUSY,DisconnectCause.CONGESTION,DisconnectCause.MMI,DisconnectCause.INVALID_NUMBER,DisconnectCause.NUMBER_UNREACHABLE,DisconnectCause.SERVER_UNREACHABLE,DisconnectCause.INVALID_CREDENTIALS,DisconnectCause.OUT_OF_NETWORK,DisconnectCause.SERVER_ERROR,DisconnectCause.TIMED_OUT,DisconnectCause.LOST_SIGNAL,DisconnectCause.LIMIT_EXCEEDED,DisconnectCause.INCOMING_REJECTED,DisconnectCause.POWER_OFF,DisconnectCause.OUT_OF_SERVICE,DisconnectCause.ICC_ERROR,DisconnectCause.CALL_BARRED,DisconnectCause.FDN_BLOCKED,DisconnectCause.CS_RESTRICTED,DisconnectCause.CS_RESTRICTED_NORMAL,DisconnectCause.CS_RESTRICTED_EMERGENCY,DisconnectCause.UNOBTAINABLE_NUMBER,DisconnectCause.CDMA_LOCKED_UNTIL_POWER_CYCLE,DisconnectCause.CDMA_DROP,DisconnectCause.CDMA_INTERCEPT,DisconnectCause.CDMA_REORDER,DisconnectCause.CDMA_SO_REJECT,DisconnectCause.CDMA_RETRY_ORDER,DisconnectCause.CDMA_ACCESS_FAILURE,DisconnectCause.CDMA_PREEMPTED,DisconnectCause.CDMA_NOT_EMERGENCY,DisconnectCause.CDMA_ACCESS_BLOCKED, orDisconnectCause.ERROR_UNSPECIFIED | 
| preciseDisconnectCause | int: the precise disconnect cause
 Value is android.telephony.PreciseDisconnectCause.NOT_VALID, android.telephony.PreciseDisconnectCause.NO_DISCONNECT_CAUSE_AVAILABLE, android.telephony.PreciseDisconnectCause.UNOBTAINABLE_NUMBER, android.telephony.PreciseDisconnectCause.NORMAL, android.telephony.PreciseDisconnectCause.BUSY, android.telephony.PreciseDisconnectCause.NUMBER_CHANGED, android.telephony.PreciseDisconnectCause.STATUS_ENQUIRY, android.telephony.PreciseDisconnectCause.NORMAL_UNSPECIFIED, android.telephony.PreciseDisconnectCause.NO_CIRCUIT_AVAIL, android.telephony.PreciseDisconnectCause.TEMPORARY_FAILURE, android.telephony.PreciseDisconnectCause.SWITCHING_CONGESTION, android.telephony.PreciseDisconnectCause.CHANNEL_NOT_AVAIL, android.telephony.PreciseDisconnectCause.QOS_NOT_AVAIL, android.telephony.PreciseDisconnectCause.BEARER_NOT_AVAIL, android.telephony.PreciseDisconnectCause.ACM_LIMIT_EXCEEDED, android.telephony.PreciseDisconnectCause.CALL_BARRED, android.telephony.PreciseDisconnectCause.FDN_BLOCKED, android.telephony.PreciseDisconnectCause.IMSI_UNKNOWN_IN_VLR, android.telephony.PreciseDisconnectCause.IMEI_NOT_ACCEPTED, android.telephony.PreciseDisconnectCause.CDMA_LOCKED_UNTIL_POWER_CYCLE, android.telephony.PreciseDisconnectCause.CDMA_DROP, android.telephony.PreciseDisconnectCause.CDMA_INTERCEPT, android.telephony.PreciseDisconnectCause.CDMA_REORDER, android.telephony.PreciseDisconnectCause.CDMA_SO_REJECT, android.telephony.PreciseDisconnectCause.CDMA_RETRY_ORDER, android.telephony.PreciseDisconnectCause.CDMA_ACCESS_FAILURE, android.telephony.PreciseDisconnectCause.CDMA_PREEMPTED, android.telephony.PreciseDisconnectCause.CDMA_NOT_EMERGENCY, android.telephony.PreciseDisconnectCause.CDMA_ACCESS_BLOCKED, or android.telephony.PreciseDisconnectCause.ERROR_UNSPECIFIED | 
onCallForwardingIndicatorChanged
public void onCallForwardingIndicatorChanged (boolean cfi)
      This method is deprecated.
    Use TelephonyCallback.CallForwardingIndicatorListener instead.
  
Callback invoked when the call-forwarding indicator changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PHONE_STATE
| Parameters | |
|---|---|
| cfi | boolean | 
onCallStateChanged
public void onCallStateChanged (int state, 
                String phoneNumber)
      This method is deprecated.
    Use TelephonyCallback.CallStateListener instead.
  
Callback invoked when device call state changes.
Reports the state of Telephony (mobile) calls on the device for the registered subscription.
 Note: the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Note: The state returned here may differ from that returned by
 TelephonyManager.getCallState(). Receivers of this callback should be aware that
 calling TelephonyManager.getCallState() from within this callback may return a
 different state than the callback reports.
 Requires Permission:
 READ_PHONE_STATE for applications
 targeting API level 31+.
| Parameters | |
|---|---|
| state | int: call state
 Value isTelephonyManager.CALL_STATE_IDLE,TelephonyManager.CALL_STATE_RINGING, orTelephonyManager.CALL_STATE_OFFHOOK | 
| phoneNumber | String: call phone number. If application does not haveREAD_CALL_LOGpermission or carrier
 privileges (seeTelephonyManager.hasCarrierPrivileges), an empty string will be
 passed as an argument. | 
onCellInfoChanged
public void onCellInfoChanged (List<CellInfo> cellInfo)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.CellInfoListener instead.
  
Callback invoked when a observed cell info has changed or new cells have been added
 or removed on the registered subscription.
 Note, the registration subId s from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
| Parameters | |
|---|---|
| cellInfo | List: is the list of currently visible cells. | 
onCellLocationChanged
public void onCellLocationChanged (CellLocation location)
      This method is deprecated.
    Use TelephonyCallback.CellLocationListener instead.
  
Callback invoked when device cell location changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.ACCESS_FINE_LOCATION
| Parameters | |
|---|---|
| location | CellLocation | 
onDataActivity
public void onDataActivity (int direction)
      This method is deprecated.
    Use TelephonyCallback.DataActivityListener instead.
  
Callback invoked when data activity state changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
| Parameters | |
|---|---|
| direction | int | 
onDataConnectionStateChanged
public void onDataConnectionStateChanged (int state, 
                int networkType)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.DataConnectionStateListener instead.
  
same as above, but with the network type. Both called.
| Parameters | |
|---|---|
| state | int | 
| networkType | int | 
onDataConnectionStateChanged
public void onDataConnectionStateChanged (int state)
      This method is deprecated.
    Use TelephonyCallback.DataConnectionStateListener instead.
  
Callback invoked when connection state changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
| Parameters | |
|---|---|
| state | int | 
onDisplayInfoChanged
public void onDisplayInfoChanged (TelephonyDisplayInfo telephonyDisplayInfo)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.DisplayInfoListener instead.
  
Callback invoked when the display info has changed on the registered subscription.
 The TelephonyDisplayInfo contains status information shown to the user based on
 carrier policy.
 For clients compiled on Android 11 SDK, requires permission:
 Manifest.permission.READ_PHONE_STATE or that the calling app has carrier
 privileges (see TelephonyManager.hasCarrierPrivileges).
 For clients compiled on Android 12 SDK or newer,
 Manifest.permission.READ_PHONE_STATE or carrier privileges is not required
 anymore.
 
 Requires Manifest.permission.READ_PHONE_STATE
| Parameters | |
|---|---|
| telephonyDisplayInfo | TelephonyDisplayInfo: The display information.
 This value cannot benull. | 
onEmergencyNumberListChanged
public void onEmergencyNumberListChanged (Map<Integer, List<EmergencyNumber>> emergencyNumberList)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.EmergencyNumberListListener instead.
  
Callback invoked when the current emergency number list has changed on the registered
 subscription.
 Note, the registered subscription is associated with TelephonyManager object
 on which TelephonyManager.listen(PhoneStateListener, int) was called.
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 given subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PHONE_STATE
| Parameters | |
|---|---|
| emergencyNumberList | Map: Map associating all active subscriptions on the device with the
                            list of emergency numbers originating from that subscription.
                            If there are no active subscriptions, the map will contain a
                            single entry withSubscriptionManager.INVALID_SUBSCRIPTION_IDas
                            the key and a list of emergency numbers as the value. If no
                            emergency number information is available, the value will be null. | 
onImsCallDisconnectCauseChanged
public void onImsCallDisconnectCauseChanged (ImsReasonInfo imsReasonInfo)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.ImsCallDisconnectCauseListener instead.
  
Callback invoked when Ims call disconnect cause changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
| Parameters | |
|---|---|
| imsReasonInfo | ImsReasonInfo:ImsReasonInfocontains details on why IMS call failed.
 This value cannot benull. | 
onMessageWaitingIndicatorChanged
public void onMessageWaitingIndicatorChanged (boolean mwi)
      This method is deprecated.
    Use TelephonyCallback.MessageWaitingIndicatorListener instead.
  
Callback invoked when the message-waiting indicator changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
 Requires Manifest.permission.READ_PHONE_STATE
| Parameters | |
|---|---|
| mwi | boolean | 
onPreciseDataConnectionStateChanged
public void onPreciseDataConnectionStateChanged (PreciseDataConnectionState dataConnectionState)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.PreciseDataConnectionStateListener instead.
  
Callback providing update about the default/internet data connection on the registered
 subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 
Requires permission Manifest.permission.READ_PRECISE_PHONE_STATE
 or the calling app has carrier privileges
 (see TelephonyManager.hasCarrierPrivileges).
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE
| Parameters | |
|---|---|
| dataConnectionState | PreciseDataConnectionState:PreciseDataConnectionStateThis value cannot benull. | 
onRegistrationFailed
public void onRegistrationFailed (CellIdentity cellIdentity, String chosenPlmn, int domain, int causeCode, int additionalCauseCode)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.RegistrationFailedListener instead.
  
Report that Registration or a Location/Routing/Tracking Area update has failed.
Indicate whenever a registration procedure, including a location, routing, or tracking area update fails. This includes procedures that do not necessarily result in a change of the modem's registration status. If the modem's registration status changes, that is reflected in the onNetworkStateChanged() and subsequent get{Voice/Data}RegistrationState().
Because registration failures are ephemeral, this callback is not sticky.
 Registrants will not receive the most recent past value when registering.
 
 Requires Manifest.permission.READ_PRECISE_PHONE_STATE and Manifest.permission.ACCESS_FINE_LOCATION
| Parameters | |
|---|---|
| cellIdentity | CellIdentity: the CellIdentity, which must include the globally unique identifier
        for the cell (for example, all components of the CGI or ECGI).
 This value cannot benull. | 
| chosenPlmn | String: a 5 or 6 digit alphanumeric PLMN (MCC|MNC) among those broadcast by the
         cell that was chosen for the failed registration attempt.
 This value cannot benull. | 
| domain | int: DOMAIN_CS, DOMAIN_PS or both in case of a combined procedure. | 
| causeCode | int: the primary failure cause code of the procedure.
        For GSM/UMTS (MM), values are in TS 24.008 Sec 10.5.95
        For GSM/UMTS (GMM), values are in TS 24.008 Sec 10.5.147
        For LTE (EMM), cause codes are TS 24.301 Sec 9.9.3.9
        For NR (5GMM), cause codes are TS 24.501 Sec 9.11.3.2
        Integer.MAX_VALUE if this value is unused. | 
| additionalCauseCode | int: the cause code of any secondary/combined procedure if appropriate.
        For UMTS, if a combined attach succeeds for PS only, then the GMM cause code shall be
        included as an additionalCauseCode. For LTE (ESM), cause codes are in
        TS 24.301 9.9.4.4. Integer.MAX_VALUE if this value is unused. | 
onServiceStateChanged
public void onServiceStateChanged (ServiceState serviceState)
      This method is deprecated.
    Use TelephonyCallback.ServiceStateListener instead.
  
Callback invoked when device service state changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
 The instance of ServiceState passed as an argument here will have various levels of
 location information stripped from it depending on the location permissions that your app
 holds. Only apps holding the Manifest.permission.ACCESS_FINE_LOCATION permission will
 receive all the information in ServiceState, otherwise the cellIdentity will be null
 if apps only holding the Manifest.permission.ACCESS_COARSE_LOCATION permission.
 Network operator name in long/short alphanumeric format and numeric id will be null if apps
 holding neither Manifest.permission.ACCESS_FINE_LOCATION nor
 Manifest.permission.ACCESS_COARSE_LOCATION.
| Parameters | |
|---|---|
| serviceState | ServiceState | 
onSignalStrengthChanged
public void onSignalStrengthChanged (int asu)
      This method was deprecated
      in API level 15.
    Use onSignalStrengthsChanged(android.telephony.SignalStrength)
  
Callback invoked when network signal strength changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
| Parameters | |
|---|---|
| asu | int | 
onSignalStrengthsChanged
public void onSignalStrengthsChanged (SignalStrength signalStrength)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.SignalStrengthsListener instead.
  
Callback invoked when network signal strengths changes on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
| Parameters | |
|---|---|
| signalStrength | SignalStrength | 
onUserMobileDataStateChanged
public void onUserMobileDataStateChanged (boolean enabled)
      This method was deprecated
      in API level 31.
    Use TelephonyCallback.UserMobileDataStateListener instead.
  
Callback invoked when the user mobile data state has changed on the registered subscription.
 Note, the registration subId comes from TelephonyManager object which registers
 PhoneStateListener by TelephonyManager.listen(PhoneStateListener, int).
 If this TelephonyManager object was created with
 TelephonyManager.createForSubscriptionId(int), then the callback applies to the
 subId. Otherwise, this callback applies to
 SubscriptionManager.getDefaultSubscriptionId().
| Parameters | |
|---|---|
| enabled | boolean: indicates whether the current user mobile data state is enabled or disabled. | 
