Skip to content

Instantly share code, notes, and snippets.

@keinix
Last active July 25, 2017 00:36
Show Gist options
  • Save keinix/3bb07d445163ad1ba5f125375bf0816b to your computer and use it in GitHub Desktop.
Save keinix/3bb07d445163ad1ba5f125375bf0816b to your computer and use it in GitHub Desktop.
private boolean networkIsAvailable() {
ConnectivityManager manager = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
boolean isAvailable = false;
if (networkInfo != null && networkInfo.isConnected()) {
isAvailable = true;
}
return isAvailable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment