@Override protected void onHandleIntent(Intent intent) { Log.d("intent=%s", StringUtil.toString(intent)); SharedPreferences preferenceManager = PreferenceManager.getDefaultSharedPreferences(this); if (!preferenceManager.getBoolean( Constants.PREF_ANDROID_WEAR, Constants.PREF_ANDROID_WEAR_DEFAULT)) { // We got triggered, but the setting is off so please don't do anything Log.d("Setting is off"); return; } int releaseDateZone = SettingsUtil.getReleaseDateZone(this); int nbDays = DateTimeUtil.getCountDownToRelease(releaseDateZone); Log.d("nbDays=%s", nbDays); WearHelper wearHelper = WearHelper.get(); wearHelper.connect(this); wearHelper.updateDays(nbDays); wearHelper.disconnect(); }
public static void scheduleAlarmIn1Minute(Context context) { Log.d(); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = getPendingIntent(context); alarmManager.set(AlarmManager.RTC_WAKEUP, DateTimeUtil.getInXSeconds(60), pendingIntent); }