ConnectivityManager.ConnectivityAction Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A change in network connectivity has occurred.
[Android.Runtime.Register("CONNECTIVITY_ACTION")]
public const string ConnectivityAction;
[<Android.Runtime.Register("CONNECTIVITY_ACTION")>]
val mutable ConnectivityAction : string
Field Value
- Attributes
Remarks
A change in network connectivity has occurred. A default connection has either been established or lost. The NetworkInfo for the affected network is sent as an extra; it should be consulted to see what kind of connectivity event occurred.
Apps targeting Android 7.0 (API level 24) and higher do not receive this broadcast if they declare the broadcast receiver in their manifest. Apps will still receive broadcasts if they register their android.content.BroadcastReceiver
with android.content.Context#registerReceiver Context.registerReceiver()
and that context is still valid.
If this is a connection that was the result of failing over from a disconnected network, then the FAILOVER_CONNECTION boolean extra is set to true.
For a loss of connectivity, if the connectivity manager is attempting to connect (or has already connected) to another network, the NetworkInfo for the new network is also passed as an extra. This lets any receivers of the broadcast know that they should not necessarily tell the user that no data traffic will be possible. Instead, the receiver should expect another broadcast soon, indicating either that the failover attempt succeeded (and so there is still overall data connectivity), or that the failover attempt failed, meaning that all connectivity has been lost.
For a disconnect event, the boolean extra EXTRA_NO_CONNECTIVITY is set to true
if there are no connected networks at all.
Note that this broadcast is deprecated and generally tries to implement backwards compatibility with older versions of Android. As such, it may not reflect new capabilities of the system, like multiple networks being connected at the same time, the details of newer technology, or changes in tethering state.
This member is deprecated. apps should use the more versatile #requestNetwork
, #registerNetworkCallback
or #registerDefaultNetworkCallback
functions instead for faster and more detailed updates about the network changes they care about.
Java documentation for android.net.ConnectivityManager.CONNECTIVITY_ACTION
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.