Stay organized with collections
Save and categorize content based on your preferences.
ConnectivityDiagnosticsCallback
abstract class ConnectivityDiagnosticsCallback
Abstract base class for Connectivity Diagnostics callbacks. Used for notifications about network connectivity events. Must be extended by applications wanting notifications.
Summary
Public methods |
open Unit |
Called when the platform completes a data connectivity check.
|
open Unit |
Called when the platform suspects a data stall on some Network.
|
open Unit |
Called when any app reports connectivity to the System.
|
Public constructors
ConnectivityDiagnosticsCallback
ConnectivityDiagnosticsCallback()
Public methods
onConnectivityReportAvailable
open fun onConnectivityReportAvailable(report: ConnectivityDiagnosticsManager.ConnectivityReport): Unit
Called when the platform completes a data connectivity check. This will also be invoked immediately upon registration for each network matching the request with the latest report, if a report has already been generated for that network.
The Network specified in the ConnectivityReport may not be active any more when this method is invoked.
onDataStallSuspected
open fun onDataStallSuspected(report: ConnectivityDiagnosticsManager.DataStallReport): Unit
Called when the platform suspects a data stall on some Network.
The Network specified in the DataStallReport may not be active any more when this method is invoked.
onNetworkConnectivityReported
open fun onNetworkConnectivityReported(
network: Network,
hasConnectivity: Boolean
): Unit
Called when any app reports connectivity to the System.
Parameters |
network |
Network: The Network for which connectivity has been reported This value cannot be null . |
hasConnectivity |
Boolean: The connectivity reported to the System |
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,["# ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nConnectivityDiagnosticsCallback\n===============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback \"View this page in Java\") \n\n```\nabstract class ConnectivityDiagnosticsCallback\n```\n\n|---|---------------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback](#) |\n\nAbstract base class for Connectivity Diagnostics callbacks. Used for notifications about network connectivity events. Must be extended by applications wanting notifications.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------|---|\n| [ConnectivityDiagnosticsCallback](#ConnectivityDiagnosticsCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnectivityReportAvailable](#onConnectivityReportAvailable(android.net.ConnectivityDiagnosticsManager.ConnectivityReport))`(`report:` `[ConnectivityDiagnosticsManager.ConnectivityReport](/reference/kotlin/android/net/ConnectivityDiagnosticsManager.ConnectivityReport)`)` Called when the platform completes a data connectivity check. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDataStallSuspected](#onDataStallSuspected(android.net.ConnectivityDiagnosticsManager.DataStallReport))`(`report:` `[ConnectivityDiagnosticsManager.DataStallReport](/reference/kotlin/android/net/ConnectivityDiagnosticsManager.DataStallReport)`)` Called when the platform suspects a data stall on some Network. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onNetworkConnectivityReported](#onNetworkConnectivityReported(android.net.Network,%20kotlin.Boolean))`(`network:` `[Network](/reference/kotlin/android/net/Network)`, `hasConnectivity:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Called when any app reports connectivity to the System. |\n\nPublic constructors\n-------------------\n\n### ConnectivityDiagnosticsCallback\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nConnectivityDiagnosticsCallback()\n```\n\nPublic methods\n--------------\n\n### onConnectivityReportAvailable\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onConnectivityReportAvailable(report: ConnectivityDiagnosticsManager.ConnectivityReport): Unit\n```\n\nCalled when the platform completes a data connectivity check. This will also be invoked immediately upon registration for each network matching the request with the latest report, if a report has already been generated for that network.\n\nThe Network specified in the ConnectivityReport may not be active any more when this method is invoked.\n\n| Parameters ||\n|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `report` | [ConnectivityDiagnosticsManager.ConnectivityReport](/reference/kotlin/android/net/ConnectivityDiagnosticsManager.ConnectivityReport): The ConnectivityReport containing information about a connectivity check This value cannot be `null`. |\n\n### onDataStallSuspected\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onDataStallSuspected(report: ConnectivityDiagnosticsManager.DataStallReport): Unit\n```\n\nCalled when the platform suspects a data stall on some Network.\n\nThe Network specified in the DataStallReport may not be active any more when this method is invoked.\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `report` | [ConnectivityDiagnosticsManager.DataStallReport](/reference/kotlin/android/net/ConnectivityDiagnosticsManager.DataStallReport): The DataStallReport containing information about the suspected data stall This value cannot be `null`. |\n\n### onNetworkConnectivityReported\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onNetworkConnectivityReported(\n network: Network, \n hasConnectivity: Boolean\n): Unit\n```\n\nCalled when any app reports connectivity to the System.\n\n| Parameters ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `network` | [Network](/reference/kotlin/android/net/Network): The Network for which connectivity has been reported This value cannot be `null`. |\n| `hasConnectivity` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): The connectivity reported to the System |"]]