The com.webos.service.alarm API enables webOS daemons or apps to call webOS API methods with specific parameters in a specified time interval.
Overview of the API(click to expand)
About webOS alarms
- A webOS alarm is a timer that causes a webOS API method to be called after a specified time interval.
- webOS manages a list of alarms in a SQL database.
- Each webOS app or daemon can have its unique set of alarms.
- webOS app can request all alrams present in alarms database.
- webOS app can request next wakeup alarm present in database.
Using the com.webos.service.alarm
- Any webOS app or daemon can use the com.webos.service.alarm API.
Wake up vs. non-wake up
An important decision that you need to make when using the com.webos.service.alarm is whether the alarm wakes up the system or not.
IMPORTANT: Waking up only applies to webOS devices that can go into a suspend state.
In order to save power, systems typically go into a suspend state. When a system is in a suspend state, none of the processes on the system are running, and the system goes into a very low power mode.
- Wake up alarm - When an alarm is set as a wake up alarm, the alarm is guaranteed to be delivered at the requested time, whether the system is awake or suspended at the requested time. If the system is suspended, system will be woken up to deliver the alarm. As one would expect, if the system is awake, the alarm is delivered normally. The wake up alarm is the most significant advantage of the alarm API over other operating system provided alarms.
- Non-wake up alarm - When an alarm is set as a non-wake up alarm, the alarm is delivered at requested time only if the system is awake at that time. If the system is suspended at the requested time, the alarm will be delivered after the system is woken up, for example, by a user action.
Wake up or non-wake up is determined by wakeup parameter in the set method.