ConnectivityManager.ActiveNetworkInfo Property
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.
Returns details about the currently active default data network.
public virtual Android.Net.NetworkInfo? ActiveNetworkInfo { [Android.Runtime.Register("getActiveNetworkInfo", "()Landroid/net/NetworkInfo;", "GetGetActiveNetworkInfoHandler")] [Android.Runtime.RequiresPermission("android.permission.ACCESS_NETWORK_STATE")] get; }
[<get: Android.Runtime.Register("getActiveNetworkInfo", "()Landroid/net/NetworkInfo;", "GetGetActiveNetworkInfoHandler")>]
[<get: Android.Runtime.RequiresPermission("android.permission.ACCESS_NETWORK_STATE")>]
member this.ActiveNetworkInfo : Android.Net.NetworkInfo
Property Value
a NetworkInfo
object for the current default network
or null
if no default network is currently active
- Attributes
Remarks
Returns details about the currently active default data network. When connected, this network is the default route for outgoing connections. You should always check NetworkInfo#isConnected()
before initiating network traffic. This may return null
when there is no default network. Note that if the default network is a VPN, this method will return the NetworkInfo for one of its underlying networks instead, or null if the VPN agent did not specify any. Apps interested in learning about VPNs should use #getNetworkInfo(android.net.Network)
instead.
This member is deprecated. See NetworkInfo
.
Java documentation for android.net.ConnectivityManager.getActiveNetworkInfo()
.
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.