protected static boolean isConnected ( Context ctx ) { ConnectivityManager connectivityManager = ( ConnectivityManager ) ctx . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo activeNetworkInfo = connectivityManager . getActiveNetworkInfo ( ) ; return activeNetworkInfo != null && activeNetworkInfo . isConnected ( ) ; }
Check whether the application has internet access at a point in time .