NetworkCollector

A device collector that gathers network connectivity information from the Android device.

This collector determines whether the device currently has an active internet connection by checking network capabilities and connectivity status. It uses different approaches based on the Android API level to ensure compatibility across device versions.

Required Permissions:

API Compatibility:

See also

for the data structure containing connectivity status

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val key: String
Link copied to clipboard
open override val serializer: KSerializer<NetworkInfo>

Functions

Link copied to clipboard
@RequiresPermission(value = "android.permission.ACCESS_NETWORK_STATE")
open suspend override fun collect(): NetworkInfo

Collects the current network connectivity status of the device.