|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Alarm
public class Alarm
Application interface to alarms. You can use Alarm to get notified based on time. Similar to the Timer class, Alarm uses the event system to send notifications. One can setup a new Alarm, activate it, and handle the alarm event callback by handling EventType.EVENT_ALARM in the receiveEvent() method. The requirement is that one has to be a listener to be able to receive alarm events. Unlike the Timer, Alarm's granularity is in seconds. From the Alarm user's perspective, Alarm also runs when the system is in the sleep mode. For example, when you set up an alarm to fire in 10 minutes, the alarm will fire in 10 minutes, whether or not the system goes into sleep mode in between.
| Constructor Summary | |
|---|---|
Alarm(int wake)
Class constructor specifying wake time. |
|
Alarm(int wake,
Listener target)
Class constructor specifying wake time and listener. |
|
Alarm(int wake,
Listener target,
int data,
Object context)
Class constructor specifying wake time, listener and context. |
|
Alarm(int wake,
Listener target,
Object context)
Class constructor specifying wake time, listener and context. |
|
| Method Summary | |
|---|---|
void |
activate()
Activate the alarm. |
void |
deactivate()
Deactivate the alarm. |
static void |
forceProcessAlarms()
Deprecated. For internal use only. |
static int |
getNextAlarmTime()
Deprecated. For internal use only. |
void |
resetWake(int inWake)
Reset the alarm's wake time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Alarm(int wake)
wake - time to wake specified in seconds from the time the Alarm is created.
public Alarm(int wake,
Listener target)
wake - time to wake specified in seconds from the time the Alarm is created.target - Listener.Listener
public Alarm(int wake,
Listener target,
Object context)
wake - time to wake specified in seconds from the time the Alarm is created.target - Listener.context - argument to be passed back in the Alarm event.Listener
public Alarm(int wake,
Listener target,
int data,
Object context)
wake - time to wake specified in seconds from the time the Alarm is created.target - Listener.data - optional data to be passed back to the Alarm event.context - argument to be passed back in the Alarm event.Listener| Method Detail |
|---|
public void activate()
Activate the alarm.
An alarm will not fire unless activate() or
resetWake(int) is called.
Alarm events will be sent to the listener when the
alarm fires. Calling this method does not affect the timing of the
alarm; the alarm will fire the specified number of seconds after
the alarm is created. Note that this behavior is different than
Timers, which fire a specified time after
Timer.start() is called.
public void deactivate()
public void resetWake(int inWake)
inWake - time to wake specified in seconds from now.public static int getNextAlarmTime()
public static void forceProcessAlarms()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||