Created
February 6, 2015 23:49
-
-
Save teabow/b836e9693e683cd60901 to your computer and use it in GitHub Desktop.
Android Connectivity Test
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 isConnected(Context context) { | |
| ConnectivityManager cm = (ConnectivityManager) context | |
| .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); | |
| return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment