In Android, I use the AlarmManager to set a repeating task that is executed once per day. The user can choose the time for this alarm. When he chooses 9:00 o’clock for example, a given task is executed every day at 9 o’clock, i.e. a pending intent is started that puts a notification to the notification bar.
Users of my app say that when their device was switched off at that time, there is no notification at all. Is it true that, when the device is off at the time when an alarm goes off, the alarm isn’t repeated after booting again?
If this is normal behaviour, how could that be circumvented? Should I write a shared preference (e.g. “last_execution_time”) in the IntentService that triggers the notification? And on boot-up, I can just check if the last execution has been more than 24 hours before, and if so, repeat it?
Register broadcast receiver for intent with action
android.intent.action.BOOT_COMPLETED, which would start the same task as you scheduled with AlarmManager (formerly ensuring that it was not fired in due time by AlarmManager).EDIT:
for keeping track try sth like that (its just a tip – handle exact time around 9 securely on your own 😉