Skip to content Skip to sidebar Skip to footer

How To Stop Android Alarmmanager When There Is A Manual System Time Change?

Here is an extended example of the problem. It is 1:30AM. Alarm is set for later today, at 10AM. I change my phones time to 1159PM yesterday. Alarm Manager instantly triggers, at t

Solution 1:

I have found the solution. It feels odd, but it is solid.

Here is what I was using originally.

alarmManager.set(AlarmManager.RTC_WAKEUP, 
    alarmTimeCalendar.getTimeInMillis(), pendingAlarmIntent);

This was the solution.

alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, alarmTimeCalendar.getTimeInMillis(),
    AlarmManager.INTERVAL_DAY, pendingAlarmIntent);

You will have to manage and cancel this AlarmManager as if it was the first method. If you forget, your alarm will ring when it should not.

Post a Comment for "How To Stop Android Alarmmanager When There Is A Manual System Time Change?"