Share via


ConnectivityManager.NetworkCallback.OnCapabilitiesChanged Method

Definition

Called when the network corresponding to this request changes capabilities but still satisfies the requested criteria.

[Android.Runtime.Register("onCapabilitiesChanged", "(Landroid/net/Network;Landroid/net/NetworkCapabilities;)V", "GetOnCapabilitiesChanged_Landroid_net_Network_Landroid_net_NetworkCapabilities_Handler")]
public virtual void OnCapabilitiesChanged (Android.Net.Network network, Android.Net.NetworkCapabilities networkCapabilities);
[<Android.Runtime.Register("onCapabilitiesChanged", "(Landroid/net/Network;Landroid/net/NetworkCapabilities;)V", "GetOnCapabilitiesChanged_Landroid_net_Network_Landroid_net_NetworkCapabilities_Handler")>]
abstract member OnCapabilitiesChanged : Android.Net.Network * Android.Net.NetworkCapabilities -> unit
override this.OnCapabilitiesChanged : Android.Net.Network * Android.Net.NetworkCapabilities -> unit

Parameters

network
Network

The Network whose capabilities have changed.

networkCapabilities
NetworkCapabilities

The new NetworkCapabilities for this network.

Attributes

Remarks

Called when the network corresponding to this request changes capabilities but still satisfies the requested criteria.

Starting with android.os.Build.VERSION_CODES#O this method is guaranteed to be called immediately after #onAvailable.

Do NOT call #getLinkProperties(Network) or other synchronous ConnectivityManager methods in this callback as this is prone to race conditions : calling these methods while in a callback may return an outdated or even a null object.

Java documentation for android.net.ConnectivityManager.NetworkCallback.onCapabilitiesChanged(android.net.Network, android.net.NetworkCapabilities).

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