When wifi is off and mobile network is off i can detect it , but when on of both is on even is there is no network my validation does not work . now i need to know how i can validate the absence of INTERNET when mobile data and WIFI are on or off.
my code:
NetworkInfo nf;
ConnectivityManager cn=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
nf=cn.getActiveNetworkInfo();
if(nf != null && nf.isConnected()==true )
{
// switch to new activity
}