I admit, after a long day and a good night's rest, I forget things from time to time. I'm only human, right? I usually have to be reminded of certain things when I wake up; that's just the way it is. The Android AlarmManager is no different. The AlarmManager does not persist alarms; therefore, when the device reboots, you must set up the alarms all over again. Although it's not a huge pain in the butt, it's something worth knowing.
If you do not set up your alarms again, they simply will not fire, because to Android they do not exist.
In the last chapter, you set up the RECEIVE_BOOT_COMPLETED permission. This permission allows your application to receive a broadcast notification from Android when the device is done booting and is eligible to be interactive with the user. Because the Android system can broadcast a message when this event is complete, you need to add another BroadcastReceiver to your project. This BroadcastReceiver is responsible for handling the boot notification from Android. When the broadcast is received, the receiver needs to connect to SQLite through the RemindersDbAdapter, loop through each task, and schedule an alarm for it. This procedure ensures that your alarms don't get lost in the reboot.
Add a new BroadcastReceiver to your application. For the Task Reminder application, I'm giving it a name of OnBootReceiver ...