|
|
|
@ -1548,21 +1548,23 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
|
|
|
|
am.cancel(pi);
|
|
|
|
|
|
|
|
|
|
boolean enabled;
|
|
|
|
|
long[] schedule = getSchedule(context);
|
|
|
|
|
if (schedule == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
long next = (now < schedule[0] ? schedule[0] : schedule[1]);
|
|
|
|
|
boolean enabled = (now >= schedule[0] && now < schedule[1]);
|
|
|
|
|
enabled = true;
|
|
|
|
|
else {
|
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
long next = (now < schedule[0] ? schedule[0] : schedule[1]);
|
|
|
|
|
enabled = (now >= schedule[0] && now < schedule[1]);
|
|
|
|
|
|
|
|
|
|
Log.i("Schedule now=" + new Date(now));
|
|
|
|
|
Log.i("Schedule start=" + new Date(schedule[0]));
|
|
|
|
|
Log.i("Schedule end=" + new Date(schedule[1]));
|
|
|
|
|
Log.i("Schedule next=" + new Date(next));
|
|
|
|
|
Log.i("Schedule enabled=" + enabled);
|
|
|
|
|
Log.i("Schedule now=" + new Date(now));
|
|
|
|
|
Log.i("Schedule start=" + new Date(schedule[0]));
|
|
|
|
|
Log.i("Schedule end=" + new Date(schedule[1]));
|
|
|
|
|
Log.i("Schedule next=" + new Date(next));
|
|
|
|
|
Log.i("Schedule enabled=" + enabled);
|
|
|
|
|
|
|
|
|
|
AlarmManagerCompat.setAndAllowWhileIdle(am, AlarmManager.RTC_WAKEUP, next, pi);
|
|
|
|
|
AlarmManagerCompat.setAndAllowWhileIdle(am, AlarmManager.RTC_WAKEUP, next, pi);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WorkerPoll.init(context, enabled);
|
|
|
|
|
}
|
|
|
|
|