Created
April 11, 2011 13:56
-
-
Save lethargicpanda/913555 to your computer and use it in GitHub Desktop.
Method checking the connectivity of an Android device
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
private static boolean checkConnectivity(Context context){ | |
ConnectivityManager connec = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
return (connec.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connec.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment