package com.thebluealliance.androidclient.helpers; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public final class ConnectionDetector { private ConnectionDetector() { // unused } public static boolean isConnectedToInternet(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getApplicationContext() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); } }