Kotlin Network Change Listener Android

[Solved] Kotlin Network Change Listener Android | Kotlin - Code Explorer | yomemimo.com
Question : kotlin network change listener android

Answered by : abdullah-0kvpuik7ilzv

 val connectivityManager = dialog.context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager connectivityManager?.let { it.registerDefaultNetworkCallback(object : ConnectivityManager.NetworkCallback() { override fun onAvailable(network: Network) { //take action when network connection is gained } override fun onLost(network: Network) { //take action when network connection is lost } }) }

Source : | Last Update : Mon, 20 Sep 21

Answers related to kotlin network change listener android

Code Explorer Popular Question For Kotlin