How can i check that internet has or not. But i found this code but when wifi connected it return true, but i know that there is not internet. No internet access.
public boolean chechInternet_con(){
ConnectivityManager connec = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
android.net.NetworkInfo wifi =connec.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
android.net.NetworkInfo mobile = connec.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
// Here if condition check for wifi and mobile network is available or not.
// If anyone of them is available or connected then it will return true, otherwise false;
if (wifi.isConnected() || mobile.isConnected()) {
return true;
}
return false;
}