# NetworkStatsManager.UsageCallback

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

# UsageCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/usage/NetworkStatsManager.UsageCallback "View this page in Java")  

```
abstract class UsageCallback
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                             ||
| ↳ | [android.app.usage.NetworkStatsManager.UsageCallback](https://developer.android.com/reference/kotlin/android/app/usage/NetworkStatsManager.UsageCallback#) |

Base class for usage callbacks. Should be extended by applications wanting notifications.

## Summary

|                                                                Public constructors                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [UsageCallback](https://developer.android.com/reference/kotlin/android/app/usage/NetworkStatsManager.UsageCallback#UsageCallback())`()` <br /> |

|                                                                                                                                                                                                                                                       Public methods                                                                                                                                                                                                                                                       ||
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onThresholdReached](https://developer.android.com/reference/kotlin/android/app/usage/NetworkStatsManager.UsageCallback#onThresholdReached(kotlin.Int,%20kotlin.String))`(`networkType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `subscriberId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Called when data usage has reached the given threshold. |

## Public constructors

### UsageCallback

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

```
UsageCallback()
```

## Public methods

### onThresholdReached

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

```
abstract fun onThresholdReached(
    networkType: Int, 
    subscriberId: String?
): Unit
```

Called when data usage has reached the given threshold.

|                                                         Parameters                                                         ||
|----------------|------------------------------------------------------------------------------------------------------------|
| `subscriberId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?:This value may be`null`. |