Skip to content Skip to sidebar Skip to footer

Android Network Is Unreachable - Enetunreach

I'm having a weird error on my android application. I'm testing with a local server using Xampp. The App is to retrieve records from a Database and store them in the phone. The thi

Solution 1:

I've figured out what was the problem! The Samsung Fame wasn't connected to the Wi-Fi. It had no internet.

Solution 2:

You can also add a check for internet connection before making any request so that user will get to know internet is not there.

Use below code and if it return false show Toast/Alert.

privatebooleanisNetworkAvailable() {
ConnectivityManagerconnectivityManager= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfoactiveNetworkInfo= connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}

Solution 3:

Have a case when my app is connecting then turn off wifi > app crash and it cannot go inside catch command Exception.

Solution 4:

please check Internet/WiFi connection on the device

Post a Comment for "Android Network Is Unreachable - Enetunreach"