AlarmManager: how to schedule a daily alarm and deal with time changes
I need to set up an alarm daily at a given hour. I'm programming the alarm using AlarmManager.RTC_WAKEUP , so it uses the system time as reference. I'm setting the alarm to first execute at the desired hour, then to repeat daily: alarmManager.setRepeating( AlarmManager.RTC_WAKEUP, getTimestampToday("12:00"), AlarmManager.INTERVAL_DAY, pendingIntent ); The getTimestampToday method returns a long timestamp for today at the desired hour. It does so by obtaining the local date for today, then setting the desired hour, finally converting it back to a timestamp (which is UTC based). The problem here