Package-level declarations
Network Monitor
This utility is designed to monitor the status of the network.
Network monitoring
To monitor the state of the network, simply subscribe to the state flow.
val scope: CoroutineScope
val networkManager: NetwrokManager
scope.launch {
networkManager.networkMonitor.networkState.collect { state ->
// do something...
}
}
Content copied to clipboard
The type NetworkState provides the following information.
data class NetworkState(
/** If true - connected to internet */
val connected: Boolean,
/** If true - connected using Wi-Fi */
val wifi: Boolean,
/** If true - connected using mobile network but in roaming */
val roaming: Boolean
)
Content copied to clipboard
Types
Link copied to clipboard
interface NetworkMonitor
This utility is used to monitor the status of the network.
Link copied to clipboard
Represents network state.