다음을 통해 공유


ConnectivityManager.NetworkCallback.OnBlockedStatusChanged Method

Definition

Called when access to the specified network is blocked or unblocked.

[Android.Runtime.Register("onBlockedStatusChanged", "(Landroid/net/Network;Z)V", "GetOnBlockedStatusChanged_Landroid_net_Network_ZHandler", ApiSince=29)]
public virtual void OnBlockedStatusChanged (Android.Net.Network network, bool blocked);
[<Android.Runtime.Register("onBlockedStatusChanged", "(Landroid/net/Network;Z)V", "GetOnBlockedStatusChanged_Landroid_net_Network_ZHandler", ApiSince=29)>]
abstract member OnBlockedStatusChanged : Android.Net.Network * bool -> unit
override this.OnBlockedStatusChanged : Android.Net.Network * bool -> unit

Parameters

network
Network

The Network whose blocked status has changed.

blocked
Boolean

The blocked status of this Network.

Attributes

Remarks

Called when access to the specified network is blocked or unblocked.

Do NOT call #getNetworkCapabilities(Network) or #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.onBlockedStatusChanged(android.net.Network, boolean).

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