ConnectivityManager.NetworkCallback.OnLost(Network) Method
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.
Called when a network disconnects or otherwise no longer satisfies this request or callback.
[Android.Runtime.Register("onLost", "(Landroid/net/Network;)V", "GetOnLost_Landroid_net_Network_Handler")]
public virtual void OnLost (Android.Net.Network network);
[<Android.Runtime.Register("onLost", "(Landroid/net/Network;)V", "GetOnLost_Landroid_net_Network_Handler")>]
abstract member OnLost : Android.Net.Network -> unit
override this.OnLost : Android.Net.Network -> unit
Parameters
- network
- Network
The Network
lost.
- Attributes
Remarks
Called when a network disconnects or otherwise no longer satisfies this request or callback.
If the callback was registered with requestNetwork() or registerDefaultNetworkCallback(), it will only be invoked against the last network returned by onAvailable() when that network is lost and no other network satisfies the criteria of the request.
If the callback was registered with registerNetworkCallback() it will be called for each network which no longer satisfies the criteria of the callback.
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.onLost(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.