Chapter 13

Reminding the User with AlarmManager

In This Chapter

arrow Understanding scheduled tasks

arrow Planning permissions

arrow Setting up alarms

arrow Seeing how device reboots affect alarms

Many tasks need to happen daily, right? Wake up, take a shower, eat breakfast — we do all these things every day. These tasks comprise the standard Monday-through-Friday prework morning routine (or a variance of it). You may have an internal clock and awaken every day on time, but most people have to set alarms to wake up on time. At work, employees have calendars that remind them of upcoming events they need to attend, such as meetings and important server upgrades. Reminders and alarms are part of most everyday routines, and people rely on them in one way or another.

Building your own scheduled task system would be a pain. Thankfully Windows has scheduled tasks, Linux has cron, and Android has the AlarmManager class. Though Android is based on Linux, it doesn’t have access to crontherefore, you have to set up scheduled actions via the Android AlarmManager.

Get Android Application Development For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.