Added in API level 31

TelephonyCallback.ActiveDataSubscriptionIdListener

public static interface TelephonyCallback.ActiveDataSubscriptionIdListener

android.telephony.TelephonyCallback.ActiveDataSubscriptionIdListener


Interface for active data subscription ID listener.

Summary

Public methods

abstract void onActiveDataSubscriptionIdChanged(int subId)

Callback invoked when active data subscription ID changes.

Public methods

onActiveDataSubscriptionIdChanged

Added in API level 31
public abstract void onActiveDataSubscriptionIdChanged (int subId)

Callback invoked when active data subscription ID changes. Note, this callback triggers regardless of registered subscription.
Requires Manifest.permission.READ_PHONE_STATE

Parameters
subId int: current subscription used to setup Cellular Internet data. The data is only active on the subscription at a time, even it is multi-SIM mode. For example, it could be the current active opportunistic subscription in use, or the subscription user selected as default data subscription in DSDS mode. The calling app should have carrier privileges (see TelephonyManager#hasCarrierPrivileges) if it does not have the Manifest.permission.READ_PHONE_STATE.