Stay organized with collections
Save and categorize content based on your preferences.
UsageCallback
abstract class UsageCallback
Base class for usage callbacks. Should be extended by applications wanting notifications.
Summary
Public methods |
abstract Unit |
Called when data usage has reached the given threshold.
|
Public constructors
UsageCallback
UsageCallback()
Public methods
onThresholdReached
abstract fun onThresholdReached(
networkType: Int,
subscriberId: String?
): Unit
Called when data usage has reached the given threshold.
Parameters |
subscriberId |
String?: This value may be null . |
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,["# NetworkStatsManager.UsageCallback\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nUsageCallback\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/usage/NetworkStatsManager.UsageCallback \"View this page in Java\") \n\n```\nabstract class UsageCallback\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.app.usage.NetworkStatsManager.UsageCallback](#) |\n\nBase class for usage callbacks. Should be extended by applications wanting notifications.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------|---|\n| [UsageCallback](#UsageCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onThresholdReached](#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. |\n\nPublic constructors\n-------------------\n\n### UsageCallback\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nUsageCallback()\n```\n\nPublic methods\n--------------\n\n### onThresholdReached\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onThresholdReached(\n networkType: Int, \n subscriberId: String?\n): Unit\n```\n\nCalled when data usage has reached the given threshold.\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------|\n| `subscriberId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: This value may be `null`. |"]]