Check connection using ConnectivityManager
suggest changepublic static boolean isConnectedNetwork (Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo () != null && cm.getActiveNetworkInfo ().isConnectedOrConnecting ();
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents