Stay organized with collections
Save and categorize content based on your preferences.
DataActivityListener
interface DataActivityListener
Interface for data activity state listener.
Summary
Public methods |
abstract Unit |
Callback invoked when data activity state changes on the registered subscription.
|
Public methods
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.DataActivityListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDataActivityListener\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/TelephonyCallback.DataActivityListener \"View this page in Java\") \n\n```\ninterface DataActivityListener\n```\n\n|---------------------------------------------------------------|\n| [android.telephony.TelephonyCallback.DataActivityListener](#) |\n\nInterface for data activity state listener.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDataActivity](#onDataActivity(kotlin.Int))`(`direction:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback invoked when data activity state changes on the registered subscription. |\n\nPublic methods\n--------------\n\n### onDataActivity\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDataActivity(direction: Int): Unit\n```\n\nCallback invoked when data activity state changes on the registered subscription. Note, the registration subscription ID comes from [TelephonyManager](/reference/kotlin/android/telephony/TelephonyManager) object which registers TelephonyCallback by [TelephonyManager.registerTelephonyCallback(Executor, TelephonyCallback)](/reference/kotlin/android/telephony/TelephonyManager#registerTelephonyCallback(java.util.concurrent.Executor,%20android.telephony.TelephonyCallback)). If this TelephonyManager object was created with [TelephonyManager.createForSubscriptionId(int)](/reference/kotlin/android/telephony/TelephonyManager#createForSubscriptionId(kotlin.Int)), then the callback applies to the subscription ID. Otherwise, this callback applies to [SubscriptionManager.getDefaultSubscriptionId()](/reference/kotlin/android/telephony/SubscriptionManager#getDefaultSubscriptionId()).\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `direction` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.telephony.TelephonyManager#DATA_ACTIVITY_NONE](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_NONE:kotlin.Int), [android.telephony.TelephonyManager#DATA_ACTIVITY_IN](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_IN:kotlin.Int), [android.telephony.TelephonyManager#DATA_ACTIVITY_OUT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_OUT:kotlin.Int), [android.telephony.TelephonyManager#DATA_ACTIVITY_INOUT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_INOUT:kotlin.Int), or [android.telephony.TelephonyManager#DATA_ACTIVITY_DORMANT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_DORMANT:kotlin.Int) |\n\n**See Also**\n\n- [android.telephony.TelephonyManager#DATA_ACTIVITY_NONE](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_NONE:kotlin.Int)\n- [android.telephony.TelephonyManager#DATA_ACTIVITY_IN](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_IN:kotlin.Int)\n- [android.telephony.TelephonyManager#DATA_ACTIVITY_OUT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_OUT:kotlin.Int)\n- [android.telephony.TelephonyManager#DATA_ACTIVITY_INOUT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_INOUT:kotlin.Int)\n- [android.telephony.TelephonyManager#DATA_ACTIVITY_DORMANT](/reference/kotlin/android/telephony/TelephonyManager#DATA_ACTIVITY_DORMANT:kotlin.Int)"]]