Added in API level 31

TelephonyCallback.DataConnectionStateListener


public static interface TelephonyCallback.DataConnectionStateListener

android.telephony.TelephonyCallback.DataConnectionStateListener


Interface for data connection state listener.

Summary

Public methods

abstract void onDataConnectionStateChanged(int state, int networkType)

Callback invoked when connection state changes on the registered subscription.

Public methods

onDataConnectionStateChanged

Added in API level 31
public abstract void onDataConnectionStateChanged (int state, 
                int networkType)

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 TelephonyManager.DATA_UNKNOWN, TelephonyManager.DATA_DISCONNECTED, TelephonyManager.DATA_CONNECTING, TelephonyManager.DATA_CONNECTED, TelephonyManager.DATA_SUSPENDED, TelephonyManager.DATA_DISCONNECTING, or TelephonyManager.DATA_HANDOVER_IN_PROGRESS

networkType int: is the current network type of data connection. Value is TelephonyManager.NETWORK_TYPE_UNKNOWN, TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_CDMA, TelephonyManager.NETWORK_TYPE_EVDO_0, TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyManager.NETWORK_TYPE_1xRTT, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, TelephonyManager.NETWORK_TYPE_HSPA, TelephonyManager.NETWORK_TYPE_IDEN, TelephonyManager.NETWORK_TYPE_EVDO_B, TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_EHRPD, TelephonyManager.NETWORK_TYPE_HSPAP, TelephonyManager.NETWORK_TYPE_GSM, TelephonyManager.NETWORK_TYPE_TD_SCDMA, TelephonyManager.NETWORK_TYPE_IWLAN, or TelephonyManager.NETWORK_TYPE_NR