When rescheduling a recurring alarm after cancelling it for today but its time is still upcoming today, create the PendingIntent that will launch PendingAlarmScheduler to reschedule the alarm with FLAG_CANCEL_CURRENT instead of FLAG_ONE_SHOT.

This commit is contained in:
Phillip Hsu 2017-03-01 15:29:50 -08:00
parent c2053dcb7a
commit dbb3ec9fd7

View File

@ -183,7 +183,7 @@ public final class AlarmController {
Intent intent = new Intent(mAppContext, PendingAlarmScheduler.class)
.putExtra(PendingAlarmScheduler.EXTRA_ALARM_ID, alarm.getId());
pi = PendingIntent.getBroadcast(mAppContext, alarm.getIntId(),
intent, PendingIntent.FLAG_ONE_SHOT);
intent, FLAG_CANCEL_CURRENT);
am.set(AlarmManager.RTC_WAKEUP, alarm.ringsAt(), pi);
} else {
scheduleAlarm(alarm, false);