Stay organized with collections
Save and categorize content based on your preferences.
ConnectivityManager.OnNetworkActiveListener
public
static
interface
ConnectivityManager.OnNetworkActiveListener
android.net.ConnectivityManager.OnNetworkActiveListener
|
Callback for use with ConnectivityManager.addDefaultNetworkActiveListener
to find out when the system default network has gone in to a high power state.
Summary
Public methods |
abstract
void
|
onNetworkActive()
Called on the main thread of the process to report that the current data network
has become active, and it is now a good time to perform any pending network
operations.
|
Public methods
onNetworkActive
public abstract void onNetworkActive ()
Called on the main thread of the process to report that the current data network
has become active, and it is now a good time to perform any pending network
operations. Note that this listener only tells you when the network becomes
active; if at any other time you want to know whether it is active (and thus okay
to initiate network traffic), you can retrieve its instantaneous state with
ConnectivityManager.isDefaultNetworkActive
.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ConnectivityManager.OnNetworkActiveListener\n\nAdded in [API level 21](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nConnectivityManager.OnNetworkActiveListener\n===========================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/net/ConnectivityManager.OnNetworkActiveListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nConnectivityManager.OnNetworkActiveListener\n`\n\n\n`\n\n\n`\n\n|---------------------------------------------------------|\n| android.net.ConnectivityManager.OnNetworkActiveListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nCallback for use with [ConnectivityManager.addDefaultNetworkActiveListener](/reference/android/net/ConnectivityManager#addDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener))\nto find out when the system default network has gone in to a high power state.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onNetworkActive](/reference/android/net/ConnectivityManager.OnNetworkActiveListener#onNetworkActive())`() ` Called on the main thread of the process to report that the current data network has become active, and it is now a good time to perform any pending network operations. |\n\nPublic methods\n--------------\n\n### onNetworkActive\n\nAdded in [API level 21](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onNetworkActive ()\n```\n\nCalled on the main thread of the process to report that the current data network\nhas become active, and it is now a good time to perform any pending network\noperations. Note that this listener only tells you when the network becomes\nactive; if at any other time you want to know whether it is active (and thus okay\nto initiate network traffic), you can retrieve its instantaneous state with\n[ConnectivityManager.isDefaultNetworkActive](/reference/android/net/ConnectivityManager#isDefaultNetworkActive()).\n\n\u003cbr /\u003e"]]