Saturday, 31 January 2015

How to set the Alarm in Android ?

* Once we have the time instance in milliseconds as a Calendar object and the pending intent pointing to the receiver, we can set up an alarm by calling the set() method of the alarm manager.


*If you use AlarmManager.RTC_WAKEUP, the alarm will wake up the device.

* Or you can use AlarmManager.RTC in its place to deliver the intent when the device wakes up.

* The time specified by the second argument is the instance in time specified by the calendarObject that was created earlier.

* This time in milliseconds since 1970.This also coincides with the Java Calendar object default.

* When the method is called, the alarm manager will invoke the TestReceiver in 30 seconds after the time when the method is called.

No comments:

Post a Comment