NetworkMonitor

interface NetworkMonitor

Monitors network connectivity state.

Platform implementations:

  • Android: Uses ConnectivityManager with NetworkCallback

  • iOS: Uses NWPathMonitor

Observe isOnline to react to connectivity changes in real time.

Inheritors

Properties

Link copied to clipboard
abstract val isOnline: StateFlow<Boolean>

Current connectivity state. True when a network is available.

Functions

Link copied to clipboard
abstract fun isCurrentlyOnline(): Boolean

Returns the current connectivity state synchronously.

Link copied to clipboard
abstract fun start()

Starts monitoring network changes. Must be called before observing isOnline.

Link copied to clipboard
abstract fun stop()

Stops monitoring and releases system resources.