Created
August 2, 2016 07:33
-
-
Save ruan65/1d17a2aedc78c81642427f9475252fcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isNetworkAvailable(Context context) { | |
ConnectivityManager connectivityManager | |
= (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); | |
return activeNetworkInfo != null && activeNetworkInfo.isConnected(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment