Added in API level 31

DataConnectionStateListener


interface DataConnectionStateListener
android.telephony.TelephonyCallback.DataConnectionStateListener

Interface for data connection state listener.

Summary

Public methods
abstract Unit
onDataConnectionStateChanged(state: Int, networkType: Int)

Callback invoked when connection state changes on the registered subscription.

Public methods

onDataConnectionStateChanged

Added in API level 31
abstract fun onDataConnectionStateChanged(
    state: Int,
    networkType: Int
): Unit

Callback invoked when connection state changes on the registered subscription. Note, the registration subscription ID comes from TelephonyManager object which registers TelephonyCallback by TelephonyManager.registerTelephonyCallback(Executor, TelephonyCallback). If this TelephonyManager object was created with TelephonyManager.createForSubscriptionId(int), then the callback applies to the subscription ID. Otherwise, this callback applies to SubscriptionManager.getDefaultSubscriptionId().

Parameters
state Int: is the current state of data connection. Value is android.telephony.TelephonyManager#DATA_UNKNOWN, android.telephony.TelephonyManager#DATA_DISCONNECTED, android.telephony.TelephonyManager#DATA_CONNECTING, android.telephony.TelephonyManager#DATA_CONNECTED, android.telephony.TelephonyManager#DATA_SUSPENDED, android.telephony.TelephonyManager#DATA_DISCONNECTING, or android.telephony.TelephonyManager#DATA_HANDOVER_IN_PROGRESS
networkType Int: is the current network type of data connection. Value is android.telephony.TelephonyManager#NETWORK_TYPE_UNKNOWN, android.telephony.TelephonyManager#NETWORK_TYPE_GPRS, android.telephony.TelephonyManager#NETWORK_TYPE_EDGE, android.telephony.TelephonyManager#NETWORK_TYPE_UMTS, android.telephony.TelephonyManager#NETWORK_TYPE_CDMA, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_0, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_A, android.telephony.TelephonyManager#NETWORK_TYPE_1xRTT, android.telephony.TelephonyManager#NETWORK_TYPE_HSDPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSUPA, android.telephony.TelephonyManager#NETWORK_TYPE_HSPA, android.telephony.TelephonyManager#NETWORK_TYPE_IDEN, android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B, android.telephony.TelephonyManager#NETWORK_TYPE_LTE, android.telephony.TelephonyManager#NETWORK_TYPE_EHRPD, android.telephony.TelephonyManager#NETWORK_TYPE_HSPAP, android.telephony.TelephonyManager#NETWORK_TYPE_GSM, android.telephony.TelephonyManager#NETWORK_TYPE_TD_SCDMA, android.telephony.TelephonyManager#NETWORK_TYPE_IWLAN, or android.telephony.TelephonyManager#NETWORK_TYPE_NR