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:
parent
c2053dcb7a
commit
dbb3ec9fd7
@ -183,7 +183,7 @@ public final class AlarmController {
|
|||||||
Intent intent = new Intent(mAppContext, PendingAlarmScheduler.class)
|
Intent intent = new Intent(mAppContext, PendingAlarmScheduler.class)
|
||||||
.putExtra(PendingAlarmScheduler.EXTRA_ALARM_ID, alarm.getId());
|
.putExtra(PendingAlarmScheduler.EXTRA_ALARM_ID, alarm.getId());
|
||||||
pi = PendingIntent.getBroadcast(mAppContext, alarm.getIntId(),
|
pi = PendingIntent.getBroadcast(mAppContext, alarm.getIntId(),
|
||||||
intent, PendingIntent.FLAG_ONE_SHOT);
|
intent, FLAG_CANCEL_CURRENT);
|
||||||
am.set(AlarmManager.RTC_WAKEUP, alarm.ringsAt(), pi);
|
am.set(AlarmManager.RTC_WAKEUP, alarm.ringsAt(), pi);
|
||||||
} else {
|
} else {
|
||||||
scheduleAlarm(alarm, false);
|
scheduleAlarm(alarm, false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user