Network changes listener implementation for android N and high
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { registerReceiver(mNetworkReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); }
Many thanks to CommonsWare for the helpful answer.
source share