Created
December 6, 2011 09:14
-
-
Save yenliangl/1437498 to your computer and use it in GitHub Desktop.
Detecting WiFi
This file contains 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 isConnected(Context context) { | |
ConnectivityManager connectivityManager = (ConnectivityManager) | |
context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo networkInfo = null; | |
if (connectivityManager != null) { | |
networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); | |
} | |
return networkInfo == null ? false : networkInfo.isConnected(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment