On Mon, Apr 14, 2014 at 2:45 PM, Prateek Jadhwani <prateekjadhw...@gmail.com
> wrote:

> Thanks Nikhil for the reply. What I am doing is trying to get a list of
> alarms in the system app. This is the code that I am using wrapped in a
> function.
>
> var request = navigator.mozAlarms.getAll();
>
> request.onsuccess = function () {
>   console.log('operation successful:' + this.result.length + 'alarms 
> pending');
>
>   this.result.forEach(function (alarm) {
>     console.log(alarm.id + ' : ' + alarm.date.toString() + ' : ' + 
> alarm.respectTimezone);
>   });}
>
> request.onerror = function () {
>   console.log('operation failed: ' + this.error);}
>
> I will try to make it work with IAC. I never knew about it. Although I
> would still love to see an example of how the above code could be modified
> to get the list of alarms.
>

If this code is running in the system app, you are getting the list of
alarms added by the system app and not the clock.

I think there seems to be confusion with what Alarms means. The Alarms API
is not for the 'wake me up every morning at 6' alarm the user adds in the
clock, but a set time in the future when the app would like to be woken up
by the system to do some task. So alarms are timers to 'start up me (the
email app) every 30 min so I can sync the user's email'. The Clock app uses
the mozAlarm API to implement the corresponding 'wake up a human' alarm. I
hope this is clear now.

Nikhil
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to