Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# TelephonyCallback.DataActivityListener

*** ** * ** ***

` public static interface TelephonyCallback.DataActivityListener `   
` `

|---|
| android.telephony.TelephonyCallback.DataActivityListener |

<br />

*** ** * ** ***

Interface for data activity state listener.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/telephony/TelephonyCallback.DataActivityListener#onDataActivity(int)(int direction) ` Callback invoked when data activity state changes on the registered subscription. |

## Public methods

### onDataActivity

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onDataActivity (int direction)
```

Callback invoked when data activity state changes on the registered subscription. Note, the registration subscription ID comes from `https://developer.android.com/reference/android/telephony/TelephonyManager` object which registers TelephonyCallback by `https://developer.android.com/reference/android/telephony/TelephonyManager#registerTelephonyCallback(java.util.concurrent.Executor,%20android.telephony.TelephonyCallback)`. If this TelephonyManager object was created with `https://developer.android.com/reference/android/telephony/TelephonyManager#createForSubscriptionId(int)`, then the callback applies to the subscription ID. Otherwise, this callback applies to `https://developer.android.com/reference/android/telephony/SubscriptionManager#getDefaultSubscriptionId()`.

<br />

| Parameters ||
|---|---|
| `direction` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_NONE` - `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_IN` - `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_OUT` - `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_INOUT` - `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_DORMANT` |

**See also:**

- `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_NONE`
- `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_IN`
- `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_OUT`
- `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_INOUT`
- `https://developer.android.com/reference/android/telephony/TelephonyManager#DATA_ACTIVITY_DORMANT`