NetworkReceiver override fun onCreate(...) { networkReceiver = NetworkReceiver { // do something } val filter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION) registerReceiver(networkReceiver, filter) } override fun onDestroy() { unregisterReceiver(networkReceiver) } }