I need help to check if there's a connection to some given URL to make sure i have a connection to the internet.
I've used this code:
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
but it's not so helpful, cause the device may be connected to WiFi or Mobile network but there's no connection to the internet.
Please help