ConnectivityManager.GetNetworkCapabilities(Network) Method

Definition

Get the NetworkCapabilities for the given Network, or null.

[Android.Runtime.Register("getNetworkCapabilities", "(Landroid/net/Network;)Landroid/net/NetworkCapabilities;", "GetGetNetworkCapabilities_Landroid_net_Network_Handler")]
[Android.Runtime.RequiresPermission("android.permission.ACCESS_NETWORK_STATE")]
public virtual Android.Net.NetworkCapabilities? GetNetworkCapabilities (Android.Net.Network? network);
[<Android.Runtime.Register("getNetworkCapabilities", "(Landroid/net/Network;)Landroid/net/NetworkCapabilities;", "GetGetNetworkCapabilities_Landroid_net_Network_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.ACCESS_NETWORK_STATE")>]
abstract member GetNetworkCapabilities : Android.Net.Network -> Android.Net.NetworkCapabilities
override this.GetNetworkCapabilities : Android.Net.Network -> Android.Net.NetworkCapabilities

Parameters

network
Network

The Network object identifying the network in question.

Returns

The NetworkCapabilities for the network, or null.

Attributes

Remarks

Get the NetworkCapabilities for the given Network, or null.

This will remove any location sensitive data in the returned NetworkCapabilities. Some TransportInfo instances like android.net.wifi.WifiInfo contain location sensitive information. To retrieve this location sensitive information (subject to the caller's location permissions), use a NetworkCallback with the NetworkCallback#FLAG_INCLUDE_LOCATION_INFO flag instead.

This method returns null if the network is unknown or if the |network| argument is null.

Java documentation for android.net.ConnectivityManager.getNetworkCapabilities(android.net.Network).

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