public static boolean isNetworkAvailable ( Context context ) { ConnectivityManager manager = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo info = manager . getActiveNetworkInfo ( ) ; return info != null && info . isAvailable ( ) ; }
Checks if the network is available or not . This is not guarantee that the network is connected and can communicate through the network .