Share via


NetworkInfo.IsAvailable Property

Definition

Indicates whether network connectivity is possible.

public virtual bool IsAvailable { [Android.Runtime.Register("isAvailable", "()Z", "GetIsAvailableHandler")] get; }
[<get: Android.Runtime.Register("isAvailable", "()Z", "GetIsAvailableHandler")>]
member this.IsAvailable : bool

Property Value

true if the network is available, false otherwise

Attributes

Remarks

Indicates whether network connectivity is possible. A network is unavailable when a persistent or semi-persistent condition prevents the possibility of connecting to that network. Examples include <ul> <li>The device is out of the coverage area for any network of this type.</li> <li>The device is on a network other than the home network (i.e., roaming), and data roaming has been disabled.</li> <li>The device's radio is turned off, e.g., because airplane mode is enabled.</li> </ul> Since Android L, this always returns true, because the system only returns info for available networks.

This member is deprecated. Apps should instead use the android.net.ConnectivityManager.NetworkCallback API to learn about connectivity changes. ConnectivityManager#registerDefaultNetworkCallback and ConnectivityManager#registerNetworkCallback. These will give a more accurate picture of the connectivity state of the device and let apps react more easily and quickly to changes.

Java documentation for android.net.NetworkInfo.isAvailable().

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.

Applies to