Skip to content

Instantly share code, notes, and snippets.

@dineshr93
Created September 1, 2015 12:38
Show Gist options
  • Select an option

  • Save dineshr93/acd65959d019987e7b31 to your computer and use it in GitHub Desktop.

Select an option

Save dineshr93/acd65959d019987e7b31 to your computer and use it in GitHub Desktop.
protected boolean isOnline()
{
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting())
{
return true;
} else
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment