AndroidNetworkConnectivity

Implementation of NetworkConnectivity for Android.

In the Android system, ConnectivityManager is used to monitor network connectivity states.

Note: This implementation requires the ACCESS_NETWORK_STATE permission.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Constructors

Link copied to clipboard
constructor(context: Context)

Functions

Link copied to clipboard
open override fun addListener(listener: Listener<NetworkConnectivityEvent>)

Registers a listener to receive events.

Link copied to clipboard
fun <E> Listenable<E>.asFlow(): Flow<E>

Converts this Listenable into a Flow that emits events.

Link copied to clipboard

Checks if there are any registered listeners.

Link copied to clipboard
open override fun notify(event: NetworkConnectivityEvent)

Notifies all registered listeners about an event.

Link copied to clipboard
open override fun removeListener(listener: Listener<NetworkConnectivityEvent>)

Unregisters a listener from receiving events.