private static boolean isNetworkConnected(ConnectivityManager connectivityManager) {
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
    if (networkInfo == null) {
      // When network information is unavailable, we conservatively
      // assume network is inaccessible.
      Log.i(TAG, "NetworkInfo null, assuming network inaccessible");
      return false;
    } else {
      return networkInfo.isConnected();
    }
  }
Returns true is network is connected (i.e. can pass data) based on the available network
information.
jobdispatcher/src/main/java/com/firebase/jobdispatcher/ConstraintChecker.java