Android How to Check Internet Connection Status

If you are developing an android application that perform internet related operations like calling web API, loading web page in Web View, uploading profile pic and etc. So before performing any internet related tasks it is better to first check that your device is connected to internet or not . Android provides ConnectivityManager class to know about the internet connection status. The following method will be very useful to know internet connection state.

First add the INTERNET and ACCESS_NETWORK_STATE permission to AndroidManifest.xml

Then use the below method to check if the device is connected to internet or not. This method will return true if the device is connected to internet.

Enjoy Coding and Share Knowledge




Show Buttons
Hide Buttons