You don't need to constantly ask the OS if there is a network connection. Simply check whether a connection exists in onResume()
and then use a BroadcastReceiver to listen for the CONNECTIVITY_ACTION Intent from the ConnectivityManager when the connection is changed and check EXTRA_NO_CONNECTIVITY.