Added in API level 1
Deprecated in API level 31

PhoneStateListener


open class PhoneStateListener
kotlin.Any
   ↳ android.telephony.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(). 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

Constants
static Int

Listen for changes to active data subId.

static Int

Listen for Barring Information for the current registered / camped cell.

static Int

Listen for call disconnect causes which contains DisconnectCause and the precise disconnect cause.

static Int

Listen for changes to the call-forwarding indicator.

static Int

Listen for changes to the device call state.

static Int

Listen for changes to observed cell info.

static Int

Listen for changes to the device's cell location.

static Int

Listen for changes to the direction of data traffic on the data connection (cellular).

static Int

Listen for changes to the data connection state (cellular).

static Int

Listen for display info changed event.

static Int

Listen for changes to emergency number list based on all active subscriptions.

static Int

Listen for IMS call disconnect causes which contains android.telephony.ims.ImsReasonInfo

static Int

Listen for changes to the message-waiting indicator.

static Int

Stop listening for updates.

static Int

Listen for PreciseDataConnectionState on the data connection (cellular).

static Int

Listen for Registration Failures.

static Int

Listen for changes to the network service state (cellular).

static Int

Listen for changes to the network signal strength (cellular).

static Int

Listen for changes to the network signal strengths (cellular).

static Int

Listen for changes to the user mobile data state

Public constructors

Create a PhoneStateListener for the Phone with the default subscription.

Create a PhoneStateListener for the Phone using the specified Executor

Public methods
open Unit

Callback invoked when active data subId changes.

open Unit

Report updated barring information for the current camped/registered cell.

open Unit
onCallDisconnectCauseChanged(disconnectCause: Int, preciseDisconnectCause: Int)

Callback invoked when call disconnect cause changes on the registered subscription.

open Unit

Callback invoked when the call-forwarding indicator changes on the registered subscription.

open Unit
onCallStateChanged(state: Int, phoneNumber: String!)

Callback invoked when device call state changes.

open Unit

Callback invoked when a observed cell info has changed or new cells have been added or removed on the registered subscription.

open Unit

Callback invoked when device cell location changes on the registered subscription.

open Unit
onDataActivity(direction: Int)

Callback invoked when data activity state changes on the registered subscription.

open Unit

Callback invoked when connection state changes on the registered subscription.

open Unit
onDataConnectionStateChanged(state: Int, networkType: Int)

same as above, but with the network type.

open Unit

Callback invoked when the display info has changed on the registered subscription.

open Unit

Callback invoked when the current emergency number list has changed on the registered subscription.

open Unit

Callback invoked when Ims call disconnect cause changes on the registered subscription.

open Unit

Callback invoked when the message-waiting indicator changes on the registered subscription.

open Unit

Callback providing update about the default/internet data connection on the registered subscription.

open Unit
onRegistrationFailed(cellIdentity: CellIdentity, chosenPlmn: String, domain: Int, causeCode: Int, additionalCauseCode: Int)

Report that Registration or a Location/Routing/Tracking Area update has failed.

open Unit

Callback invoked when device service state changes on the registered subscription.

open Unit

Callback invoked when network signal strength changes on the registered subscription.

open Unit

Callback invoked when network signal strengths changes on the registered subscription.

open Unit

Callback invoked when the user mobile data state has changed on the registered subscription.

Constants

LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE

Added in API level 29
Deprecated in API level 31
static val LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE: Int

Deprecated: 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 android.Manifest.permission#READ_PHONE_STATE

Value: 4194304

LISTEN_BARRING_INFO

Added in API level 30
Deprecated in API level 31
static val LISTEN_BARRING_INFO: Int

Deprecated: Use TelephonyCallback.BarringInfoListener instead.

Listen for Barring Information for the current registered / camped cell.

Requires permission android.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 android.Manifest.permission#READ_PRECISE_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION

Value: -2147483648

LISTEN_CALL_DISCONNECT_CAUSES

Added in API level 30
Deprecated in API level 31
static val LISTEN_CALL_DISCONNECT_CAUSES: Int

Deprecated: Use TelephonyCallback.CallDisconnectCauseListener instead.

Listen for call disconnect causes which contains DisconnectCause and the precise disconnect cause.

Requires permission android.Manifest.permission#READ_PRECISE_PHONE_STATE or the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PRECISE_PHONE_STATE

Value: 33554432

LISTEN_CALL_FORWARDING_INDICATOR

Added in API level 1
static val LISTEN_CALL_FORWARDING_INDICATOR: Int

Deprecated: Use TelephonyCallback.CallForwardingIndicatorListener instead.

Listen for changes to the call-forwarding indicator. {@more} Requires Permission: READ_PHONE_STATE or that the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
Requires android.Manifest.permission#READ_PHONE_STATE

Value: 8

LISTEN_CALL_STATE

Added in API level 1
static val LISTEN_CALL_STATE: Int

Deprecated: Use TelephonyCallback.CallStateListener instead.

Listen for changes to the device call state. {@more}

Value: 32

LISTEN_CELL_INFO

Added in API level 17
Deprecated in API level 31
static val LISTEN_CELL_INFO: Int

Deprecated: 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 android.Manifest.permission#READ_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION

Value: 1024

LISTEN_CELL_LOCATION

Added in API level 1
static val LISTEN_CELL_LOCATION: Int

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. {@more} 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 android.Manifest.permission#ACCESS_FINE_LOCATION

Value: 16

LISTEN_DATA_ACTIVITY

Added in API level 1
static val LISTEN_DATA_ACTIVITY: Int

Deprecated: Use TelephonyCallback.DataActivityListener instead.

Listen for changes to the direction of data traffic on the data connection (cellular). {@more} Example: The status bar uses this to display the appropriate data-traffic icon.

Value: 128

See Also

LISTEN_DATA_CONNECTION_STATE

Added in API level 1
static val LISTEN_DATA_CONNECTION_STATE: Int

Deprecated: Use TelephonyCallback.DataConnectionStateListener instead.

Listen for changes to the data connection state (cellular).

Value: 64

See Also

    LISTEN_DISPLAY_INFO_CHANGED

    Added in API level 30
    Deprecated in API level 31
    static val LISTEN_DISPLAY_INFO_CHANGED: Int

    Deprecated: Use TelephonyCallback.DisplayInfoListener instead.

    Listen for display info changed event. For clients compiled on Android 11 SDK, requires permission: android.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, android.Manifest.permission#READ_PHONE_STATE or carrier privileges is not required anymore.

    Value: 1048576

    LISTEN_EMERGENCY_NUMBER_LIST

    Added in API level 29
    Deprecated in API level 31
    static val LISTEN_EMERGENCY_NUMBER_LIST: Int

    Deprecated: Use TelephonyCallback.EmergencyNumberListListener instead.

    Listen for changes to emergency number list based on all active subscriptions.

    Requires permission android.Manifest.permission#READ_PHONE_STATE or the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
    Requires android.Manifest.permission#READ_PHONE_STATE

    Value: 16777216

    LISTEN_IMS_CALL_DISCONNECT_CAUSES

    Added in API level 30
    Deprecated in API level 31
    static val LISTEN_IMS_CALL_DISCONNECT_CAUSES: Int

    Deprecated: Use TelephonyCallback.ImsCallDisconnectCauseListener instead.

    Listen for IMS call disconnect causes which contains android.telephony.ims.ImsReasonInfo

    Requires permission android.Manifest.permission#READ_PRECISE_PHONE_STATE or the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
    Requires android.Manifest.permission#READ_PRECISE_PHONE_STATE

    Value: 134217728

    LISTEN_MESSAGE_WAITING_INDICATOR

    Added in API level 1
    static val LISTEN_MESSAGE_WAITING_INDICATOR: Int

    Deprecated: Use TelephonyCallback.MessageWaitingIndicatorListener instead.

    Listen for changes to the message-waiting indicator. {@more} 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 android.Manifest.permission#READ_PHONE_STATE

    Value: 4

    LISTEN_NONE

    Added in API level 1
    static val LISTEN_NONE: Int

    Deprecated: Deprecated in Java.

    Stop listening for updates. The PhoneStateListener is not tied to any subscription and unregistered for any update.

    Value: 0

    LISTEN_PRECISE_DATA_CONNECTION_STATE

    Added in API level 30
    Deprecated in API level 31
    static val LISTEN_PRECISE_DATA_CONNECTION_STATE: Int

    Deprecated: Use TelephonyCallback.PreciseDataConnectionStateListener instead.

    Listen for PreciseDataConnectionState on the data connection (cellular).

    Requires permission android.Manifest.permission#READ_PRECISE_PHONE_STATE or the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
    Requires android.Manifest.permission#READ_PRECISE_PHONE_STATE

    Value: 4096

    LISTEN_REGISTRATION_FAILURE

    Added in API level 30
    Deprecated in API level 31
    static val LISTEN_REGISTRATION_FAILURE: Int

    Deprecated: 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 android.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 android.Manifest.permission#READ_PRECISE_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION

    Value: 1073741824

    LISTEN_SERVICE_STATE

    Added in API level 1
    static val LISTEN_SERVICE_STATE: Int

    Deprecated: Use TelephonyCallback.ServiceStateListener instead.

    Listen for changes to the network service state (cellular).

    Value: 1

    LISTEN_SIGNAL_STRENGTH

    Added in API level 1
    Deprecated in API level 15
    static val LISTEN_SIGNAL_STRENGTH: Int

    Deprecated: Use TelephonyCallback.SignalStrengthsListener instead.

    Listen for changes to the network signal strength (cellular). {@more}

    Value: 2

    LISTEN_SIGNAL_STRENGTHS

    Added in API level 7
    Deprecated in API level 31
    static val LISTEN_SIGNAL_STRENGTHS: Int

    Deprecated: 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.

    Value: 256

    LISTEN_USER_MOBILE_DATA_STATE

    Added in API level 28
    Deprecated in API level 31
    static val LISTEN_USER_MOBILE_DATA_STATE: Int

    Deprecated: Use TelephonyCallback.UserMobileDataStateListener instead.

    Listen for changes to the user mobile data state

    Value: 524288

    Public constructors

    PhoneStateListener

    Added in API level 1
    PhoneStateListener()

    Create a PhoneStateListener for the Phone with the default subscription. This class requires Looper.myLooper() not return null.

    PhoneStateListener

    Added in API level 29
    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

    Added in API level 29
    Deprecated in API level 31
    open fun onActiveDataSubscriptionIdChanged(subId: Int): Unit

    Deprecated: 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 android.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

    Added in API level 30
    Deprecated in API level 31
    open fun onBarringInfoChanged(barringInfo: BarringInfo): Unit

    Deprecated: 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION

    Parameters
    barringInfo BarringInfo: for all services on the current cell. This value cannot be null.

    onCallDisconnectCauseChanged

    Added in API level 30
    Deprecated in API level 31
    open fun onCallDisconnectCauseChanged(
        disconnectCause: Int,
        preciseDisconnectCause: Int
    ): Unit

    Deprecated: 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE

    Parameters
    disconnectCause Int: the disconnect cause Value is android.telephony.DisconnectCause#NOT_VALID, android.telephony.DisconnectCause#NOT_DISCONNECTED, android.telephony.DisconnectCause#INCOMING_MISSED, android.telephony.DisconnectCause#NORMAL, android.telephony.DisconnectCause#LOCAL, android.telephony.DisconnectCause#BUSY, android.telephony.DisconnectCause#CONGESTION, android.telephony.DisconnectCause#MMI, android.telephony.DisconnectCause#INVALID_NUMBER, android.telephony.DisconnectCause#NUMBER_UNREACHABLE, android.telephony.DisconnectCause#SERVER_UNREACHABLE, android.telephony.DisconnectCause#INVALID_CREDENTIALS, android.telephony.DisconnectCause#OUT_OF_NETWORK, android.telephony.DisconnectCause#SERVER_ERROR, android.telephony.DisconnectCause#TIMED_OUT, android.telephony.DisconnectCause#LOST_SIGNAL, android.telephony.DisconnectCause#LIMIT_EXCEEDED, android.telephony.DisconnectCause#INCOMING_REJECTED, android.telephony.DisconnectCause#POWER_OFF, android.telephony.DisconnectCause#OUT_OF_SERVICE, android.telephony.DisconnectCause#ICC_ERROR, android.telephony.DisconnectCause#CALL_BARRED, android.telephony.DisconnectCause#FDN_BLOCKED, android.telephony.DisconnectCause#CS_RESTRICTED, android.telephony.DisconnectCause#CS_RESTRICTED_NORMAL, android.telephony.DisconnectCause#CS_RESTRICTED_EMERGENCY, android.telephony.DisconnectCause#UNOBTAINABLE_NUMBER, android.telephony.DisconnectCause#CDMA_LOCKED_UNTIL_POWER_CYCLE, android.telephony.DisconnectCause#CDMA_DROP, android.telephony.DisconnectCause#CDMA_INTERCEPT, android.telephony.DisconnectCause#CDMA_REORDER, android.telephony.DisconnectCause#CDMA_SO_REJECT, android.telephony.DisconnectCause#CDMA_RETRY_ORDER, android.telephony.DisconnectCause#CDMA_ACCESS_FAILURE, android.telephony.DisconnectCause#CDMA_PREEMPTED, android.telephony.DisconnectCause#CDMA_NOT_EMERGENCY, android.telephony.DisconnectCause#CDMA_ACCESS_BLOCKED, or android.telephony.DisconnectCause#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

    Added in API level 1
    open fun onCallForwardingIndicatorChanged(cfi: Boolean): Unit

    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 android.Manifest.permission#READ_PHONE_STATE

    onCallStateChanged

    Added in API level 1
    open fun onCallStateChanged(
        state: Int,
        phoneNumber: String!
    ): Unit

    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 is android.telephony.TelephonyManager#CALL_STATE_IDLE, android.telephony.TelephonyManager#CALL_STATE_RINGING, or android.telephony.TelephonyManager#CALL_STATE_OFFHOOK
    phoneNumber String!: call phone number. If application does not have READ_CALL_LOG permission or carrier privileges (see TelephonyManager#hasCarrierPrivileges), an empty string will be passed as an argument.

    onCellInfoChanged

    Added in API level 17
    Deprecated in API level 31
    open fun onCellInfoChanged(cellInfo: MutableList<CellInfo!>!): Unit

    Deprecated: 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 android.Manifest.permission#READ_PHONE_STATE and android.Manifest.permission#ACCESS_FINE_LOCATION

    Parameters
    cellInfo MutableList<CellInfo!>!: is the list of currently visible cells.

    onCellLocationChanged

    Added in API level 1
    open fun onCellLocationChanged(location: CellLocation!): Unit

    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 android.Manifest.permission#ACCESS_FINE_LOCATION

    onDataActivity

    Added in API level 1
    open fun onDataActivity(direction: Int): Unit

    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().

    onDataConnectionStateChanged

    Added in API level 1
    open fun onDataConnectionStateChanged(state: Int): Unit

    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().

    onDataConnectionStateChanged

    Added in API level 7
    Deprecated in API level 31
    open fun onDataConnectionStateChanged(
        state: Int,
        networkType: Int
    ): Unit

    Deprecated: Use TelephonyCallback.DataConnectionStateListener instead.

    same as above, but with the network type. Both called.

    onDisplayInfoChanged

    Added in API level 30
    Deprecated in API level 31
    open fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo): Unit

    Deprecated: 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: android.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, android.Manifest.permission#READ_PHONE_STATE or carrier privileges is not required anymore.
    Requires android.Manifest.permission#READ_PHONE_STATE

    Parameters
    telephonyDisplayInfo TelephonyDisplayInfo: The display information. This value cannot be null.

    onEmergencyNumberListChanged

    Added in API level 31
    Deprecated in API level 31
    open fun onEmergencyNumberListChanged(emergencyNumberList: MutableMap<Int!, MutableList<EmergencyNumber!>!>): Unit

    Deprecated: 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 android.Manifest.permission#READ_PHONE_STATE

    Parameters
    emergencyNumberList MutableMap<Int!, MutableList<EmergencyNumber!>!>: 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 with SubscriptionManager#INVALID_SUBSCRIPTION_ID as the key and a list of emergency numbers as the value. If no emergency number information is available, the value will be null.

    onImsCallDisconnectCauseChanged

    Added in API level 30
    Deprecated in API level 31
    open fun onImsCallDisconnectCauseChanged(imsReasonInfo: ImsReasonInfo): Unit

    Deprecated: 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE

    Parameters
    imsReasonInfo ImsReasonInfo: ImsReasonInfo contains details on why IMS call failed. This value cannot be null.

    onMessageWaitingIndicatorChanged

    Added in API level 1
    open fun onMessageWaitingIndicatorChanged(mwi: Boolean): Unit

    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 android.Manifest.permission#READ_PHONE_STATE

    onPreciseDataConnectionStateChanged

    Added in API level 30
    Deprecated in API level 31
    open fun onPreciseDataConnectionStateChanged(dataConnectionState: PreciseDataConnectionState): Unit

    Deprecated: 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE or the calling app has carrier privileges (see TelephonyManager#hasCarrierPrivileges).
    Requires android.Manifest.permission#READ_PRECISE_PHONE_STATE

    Parameters
    dataConnectionState PreciseDataConnectionState: PreciseDataConnectionState This value cannot be null.

    onRegistrationFailed

    Added in API level 30
    Deprecated in API level 31
    open fun onRegistrationFailed(
        cellIdentity: CellIdentity,
        chosenPlmn: String,
        domain: Int,
        causeCode: Int,
        additionalCauseCode: Int
    ): Unit

    Deprecated: 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 android.Manifest.permission#READ_PRECISE_PHONE_STATE and android.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 be null.
    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 be null.
    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

    Added in API level 1
    open fun onServiceStateChanged(serviceState: ServiceState!): Unit

    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 android.Manifest.permission#ACCESS_FINE_LOCATION nor android.Manifest.permission#ACCESS_COARSE_LOCATION.

    onSignalStrengthChanged

    Added in API level 1
    Deprecated in API level 15
    open fun onSignalStrengthChanged(asu: Int): Unit

    Deprecated: 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().

    onSignalStrengthsChanged

    Added in API level 7
    Deprecated in API level 31
    open fun onSignalStrengthsChanged(signalStrength: SignalStrength!): Unit

    Deprecated: 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().

    onUserMobileDataStateChanged

    Added in API level 28
    Deprecated in API level 31
    open fun onUserMobileDataStateChanged(enabled: Boolean): Unit

    Deprecated: 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.