It would be unwise to check the connection every second. Alternatively, you can listen to the action ( ConnectivityManager.CONNECTIVITY_ACTION ) and determine if you are connected to an active network or not.
IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
In addition, you can check the type of network that is currently active (Type_WIFI, Type_MOBILE)
Thus, you do not need a service that checks the connection every second.
source share