Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created May 8, 2013 14:09
Show Gist options
  • Save mcatta/5540683 to your computer and use it in GitHub Desktop.
Save mcatta/5540683 to your computer and use it in GitHub Desktop.
Android check connectivity
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
public static boolean CheckIntConn(Activity activity) {
ConnectivityManager connectivityManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment