O'Reilly logo

Pro Android 4 by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Alarm Manager Basics: Setting Up a Simple Alarm

We will start the chapter with setting an alarm at a particular time and having it call a broadcast receiver. Once the broadcast receiver is invoked, we can use the information from Chapter 19 to perform both simple and long-running operations in that broadcast receiver.

The steps are as follows:

  1. Get access to the alarm manager.
  2. Come up with a time to set the alarm.
  3. Create a receiver to be invoked.
  4. Create a pending intent that can be passed to the alarm manager to invoke the receiver at the appointed time.
  5. Use the time instance from step 2 and the pending intent from step 4 to set the alarm.
  6. See the receiver from step 3 invoked.

Getting Access to the Alarm Manager

Getting access to the alarm manager ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required