-
public interface StreamNetworkMonitorListenerReceives network availability and capability updates from StreamNetworkMonitor.
-
-
Method Summary
Modifier and Type Method Description UnitonNetworkConnected(StreamNetworkInfo.Snapshot snapshot)Called when the network is connected. UnitonNetworkLost(Boolean permanent)Called when the network is lost. UnitonNetworkPropertiesChanged(StreamNetworkInfo.Snapshot snapshot)Called when the properties of the currently connected network change while the connection remains active. -
-
Method Detail
-
onNetworkConnected
Unit onNetworkConnected(StreamNetworkInfo.Snapshot snapshot)
Called when the network is connected.
override suspend fun onNetworkConnected(snapshot: StreamNetworkInfo.Snapshot?) { logger.i { "Network connected: ${snapshot?.type}" } }- Parameters:
snapshot- A StreamNetworkInfo.Snapshot describing the newly connected network.
-
onNetworkLost
Unit onNetworkLost(Boolean permanent)
Called when the network is lost.
override suspend fun onNetworkLost(permanent: Boolean) { retryScheduler.pause() if (permanent) alertUser() }- Parameters:
permanent- True if the network is lost permanently (e.g., onUnavailable called).
-
onNetworkPropertiesChanged
Unit onNetworkPropertiesChanged(StreamNetworkInfo.Snapshot snapshot)
Called when the properties of the currently connected network change while the connection remains active.
override suspend fun onNetworkPropertiesChanged(snapshot: StreamNetworkInfo.Snapshot) { metrics.recordThroughput(snapshot.linkBandwidthDownKbps) }- Parameters:
snapshot- A StreamNetworkInfo.Snapshot containing the updated properties.
-
-
-
-