private boolean _check_cancellation(){
  SharedPreferences pref=PreferenceManager.getDefaultSharedPreferences(this);
  if (!pref.getBoolean(SettingsFragment.KEY_PREF_BACKGROUND_CHECKS,false)) {
    return true;
  }
  if (pref.getBoolean(SettingsFragment.KEY_PREF_WIFI_ONLY,true)) {
    ConnectivityManager connectivityManager=(ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo info=connectivityManager.getActiveNetworkInfo();
    if (info == null) {
      Log.v(MainActivity.TAG,"Aborting automatic checks because no network is currently active.");
      return true;
    }
 else     if (info.getType() != ConnectivityManager.TYPE_WIFI) {
      Log.v(MainActivity.TAG,"Aborting automatic checks over data due to user preferences.");
      return true;
    }
  }
  return false;
}

private boolean _check_cancellation ( ) { SharedPreferences pref = PreferenceManager . getDefaultSharedPreferences ( this ) ; if ( ! pref . getBoolean ( SettingsFragment . KEY_PREF_BACKGROUND_CHECKS , false ) ) { return true ; } if ( pref . getBoolean ( SettingsFragment . KEY_PREF_WIFI_ONLY , true ) ) { ConnectivityManager connectivityManager = ( ConnectivityManager ) getSystemService ( CONNECTIVITY_SERVICE ) ; NetworkInfo info = connectivityManager . getActiveNetworkInfo ( ) ; if ( info == null ) { Log . v ( MainActivity . TAG , "Aborting automatic checks because no network is currently active." ) ; return true ; } else if ( info . getType ( ) != ConnectivityManager . TYPE_WIFI ) { Log . v ( MainActivity . TAG , "Aborting automatic checks over data due to user preferences." ) ; return true ; } } return false ; }
checks whether the check should be aborted . this may happen depending on user preferences ( i . e . wifi only )
