fun addOnWifiConnectedChangedListener(onWifiChanged: (Boolean) -> Unit) { val lastKnownState = lastKnownStateWasAvailable if (callbacks.add(onWifiChanged) && lastKnownState != null) { onWifiChanged(lastKnownState) } }
Adds [onWifiChanged] to a list of listeners that will be called whenever WIFI connects or disconnects.