Connectivity

interface Connectivity

The Connectivity interface provides a way to monitor the network connectivity status.

Types

Link copied to clipboard
sealed interface Status

Represents the connectivity status.

Link copied to clipboard
class Update(val isMonitoring: Boolean, val status: Connectivity.Status)

Represents an update to the connectivity status.

Properties

Link copied to clipboard

A Flow representing status updates when the connectivity monitoring is active.

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

A StateFlow representing whether the connectivity monitoring is active.

Link copied to clipboard
abstract val statusUpdates: SharedFlow<Connectivity.Status>

A SharedFlow representing the current connectivity status.

Link copied to clipboard
abstract val updates: StateFlow<Connectivity.Update>

A StateFlow representing the current connectivity status and whether the monitoring is active.

Functions

Link copied to clipboard
abstract fun start()

Starts monitoring the connectivity status.

Link copied to clipboard
abstract suspend fun status(): Connectivity.Status

Gets the current connectivity status.

Link copied to clipboard
abstract fun stop()

Stops monitoring the connectivity status.