# ConnectivityObserver

class ConnectivityObserver(context: Context, hostMetaUrl: URL, processLifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get(), mainHandler: Handler = Handler(Looper.getMainLooper()), networkRequest: NetworkRequest = NetworkRequest .Builder() .addCapability(NET_CAPABILITY_INTERNET) .addTransportType(TRANSPORT_CELLULAR) .addTransportType(TRANSPORT_WIFI) .addTransportType(TRANSPORT_VPN) .build(), scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)) : ConnectivityManager.NetworkCallback, DefaultLifecycleObserver

## Constructors

ConnectivityObserver
Link copied to clipboard
constructor(context: Context, hostMetaUrl: URL, processLifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get(), mainHandler: Handler = Handler(Looper.getMainLooper()), networkRequest: NetworkRequest = NetworkRequest .Builder() .addCapability(NET_CAPABILITY_INTERNET) .addTransportType(TRANSPORT_CELLULAR) .addTransportType(TRANSPORT_WIFI) .addTransportType(TRANSPORT_VPN) .build(), scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO))

## Types

Companion
Link copied to clipboard
object Companion

## Properties

isConnected
Link copied to clipboard
val isConnected: StateFlow<Boolean>

## Functions

destroy
Link copied to clipboard
fun destroy()
hasReachableInternetStrict
Link copied to clipboard
suspend fun hasReachableInternetStrict(): Boolean
onAvailable
Link copied to clipboard
open override fun onAvailable(network: Network)
onBlockedStatusChanged
Link copied to clipboard
open fun onBlockedStatusChanged(p0: Network, p1: Boolean)
onCapabilitiesChanged
Link copied to clipboard
open override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities)
onCreate
Link copied to clipboard
open fun onCreate(owner: LifecycleOwner)
onDestroy
Link copied to clipboard
open fun onDestroy(owner: LifecycleOwner)
onLinkPropertiesChanged
Link copied to clipboard
open fun onLinkPropertiesChanged(p0: Network, p1: LinkProperties)
onLosing
Link copied to clipboard
open fun onLosing(p0: Network, p1: Int)
onLost
Link copied to clipboard
open override fun onLost(network: Network)
onPause
Link copied to clipboard
open fun onPause(owner: LifecycleOwner)
onResume
Link copied to clipboard
open fun onResume(owner: LifecycleOwner)
onStart
Link copied to clipboard
open override fun onStart(owner: LifecycleOwner)
onStop
Link copied to clipboard
open override fun onStop(owner: LifecycleOwner)
onUnavailable
Link copied to clipboard
open fun onUnavailable()
refreshNetworksAndCheck
Link copied to clipboard
fun refreshNetworksAndCheck()