ConnectivityManager.NetworkCallback.OnLosing(Network, Int32) 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 the network is about to be lost, typically because there are no outstanding requests left for it.
[Android.Runtime.Register("onLosing", "(Landroid/net/Network;I)V", "GetOnLosing_Landroid_net_Network_IHandler")]
public virtual void OnLosing (Android.Net.Network network, int maxMsToLive);
[<Android.Runtime.Register("onLosing", "(Landroid/net/Network;I)V", "GetOnLosing_Landroid_net_Network_IHandler")>]
abstract member OnLosing : Android.Net.Network * int -> unit
override this.OnLosing : Android.Net.Network * int -> unit
Parameters
- network
- Network
The Network
that is about to be lost.
- maxMsToLive
- Int32
The time in milliseconds the system intends to keep the network connected for graceful handover; note that the network may still suffer a hard loss at any time.
- Attributes
Remarks
Called when the network is about to be lost, typically because there are no outstanding requests left for it. This may be paired with a NetworkCallback#onAvailable
call with the new replacement network for graceful handover. This method is not guaranteed to be called before NetworkCallback#onLost
is called, for example in case a network is suddenly disconnected.
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.
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.