Stay organized with collections
Save and categorize content based on your preferences.
ActiveDataSubscriptionIdListener
interface ActiveDataSubscriptionIdListener
Interface for active data subscription ID listener.
Summary
Public methods |
abstract Unit |
Callback invoked when active data subscription ID changes.
|
Public methods
onActiveDataSubscriptionIdChanged
abstract fun onActiveDataSubscriptionIdChanged(subId: Int): Unit
Callback invoked when active data subscription ID changes. Note, this callback triggers regardless of registered subscription.
Requires android.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 android.Manifest.permission#READ_PHONE_STATE . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TelephonyCallback.ActiveDataSubscriptionIdListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nActiveDataSubscriptionIdListener\n================================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/TelephonyCallback.ActiveDataSubscriptionIdListener \"View this page in Java\") \n\n```\ninterface ActiveDataSubscriptionIdListener\n```\n\n|---------------------------------------------------------------------------|\n| [android.telephony.TelephonyCallback.ActiveDataSubscriptionIdListener](#) |\n\nInterface for active data subscription ID listener.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onActiveDataSubscriptionIdChanged](#onActiveDataSubscriptionIdChanged(kotlin.Int))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback invoked when active data subscription ID changes. |\n\nPublic methods\n--------------\n\n### onActiveDataSubscriptionIdChanged\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onActiveDataSubscriptionIdChanged(subId: Int): Unit\n```\n\nCallback invoked when active data subscription ID changes. Note, this callback triggers regardless of registered subscription. \nRequires [android.Manifest.permission#READ_PHONE_STATE](../Manifest.permission.html#READ_PHONE_STATE:kotlin.String)\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `subId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): 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](/reference/kotlin/android/telephony/TelephonyManager#hasCarrierPrivileges())) if it does not have the [android.Manifest.permission#READ_PHONE_STATE](../Manifest.permission.html#READ_PHONE_STATE:kotlin.String). |"]]