private static boolean isNetAvailable(Context context){
                        ConnectivityManager manager= (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
                        NetworkInfo info=manager.getActiveNetworkInfo();
                        return info== null ? false:true;
                    }
Copy the code