Beispiel #1
0
  @Override
  public void onReceive(Context appContext, Intent intent) {
    context = appContext;
    loc = Localizator.geoLocate(context);
    if (loc != null) {
      URLForecast = Conversor.getUrlForecast(loc);

      /*
       * Toast.makeText(context,
       * "¡Vibration Mode On porque el tiempo se ha terminado!",
       * Toast.LENGTH_LONG).show();
       */

      // Define la vibracion del telefono

      /*
       * Vibrator vibrator = (Vibrator) context
       * .getSystemService(Context.VIBRATOR_SERVICE);
       * vibrator.vibrate(1000);
       */
      prefs = context.getSharedPreferences(Values.getPrefs(), Context.MODE_PRIVATE);
      prefs.edit().putBoolean("active", true).commit();
      check_server();
    } else {
      Log.e(LogDavid, "LOC NULL");
      if (!Localizator.isProviderEnabled(appContext)) {
        Notifications notif = new Notifications(appContext);
        notif.providerDisabled();
      } else {

      }
    }
  }
Beispiel #2
0
 private boolean necesaryUpdate() {
   prefs = context.getSharedPreferences(Values.getPrefs(), Context.MODE_PRIVATE);
   long date_last_update = prefs.getLong("date_update", 0) * 1000;
   if ((System.currentTimeMillis() - date_last_update) < Values.elapsed_time / 2) {
     return false;
   }
   Log.d(LogDavid, "UPDATE_NECESARY");
   return true;
 }