ConnectivityMonitor

Connectivity monitor can be used to monitor changes to host network connectivity changes.

Types

Link copied to clipboard
interface Listener
The contract of a listener that can receive callback notifications from the ConnectivityMonitor
Link copied to clipboard
annotation class NetworkType
List of supported network types.

Properties

Link copied to clipboard
An array of all supported network types.

Functions

Link copied to clipboard
Adds the specified listener to the list of listeners that will be notified when the host device's network connectivity state changes.
Link copied to clipboard
Gets the human readable name of the current network, if connected.
Link copied to clipboard
open fun getInstance(context: Context): ConnectivityMonitor
Get reference to a cached instance of ConnectivityMonitor.
Link copied to clipboard
open fun isConnected(): Boolean
Checks if the host device has an active network connection.
open fun isConnected(networkEntitlements: SparseArray<Boolean>): Boolean
open fun isConnected(allowedTypes: Array<Int>): Boolean
Checks if the host device is connected to the using one of the allowed network type.
open fun isConnected(networkInfo: NetworkInfo, networkEntitlements: SparseArray<Boolean>): Boolean
Checks if the specified network is one of the allowed network type.
Link copied to clipboard
Checks if the active network connection is a Wi-Fi network.
Link copied to clipboard
Removes the specified listener from the list of listeners that will be notified when the host device's network connectivity state changes.