Tuesday, 27 January 2015

What are the steps to set up a simple alarm in android ?

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 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.

No comments:

Post a Comment