Last active
August 29, 2015 14:18
-
-
Save searover/072ee239609e165bf411 to your computer and use it in GitHub Desktop.
android code for checking is online
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 boolean isOnline() { | |
ConnectivityManager connMgr = (ConnectivityManager) | |
getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); | |
return (networkInfo != null && networkInfo.isConnected()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment