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.

Thanks

*Prateek Jadhwani*
www.prateekjadhwani.com


On Mon, Apr 14, 2014 at 5:29 PM, <[email protected]> wrote:

> On Thursday, April 10, 2014 4:52:55 PM UTC-7, Prateek Jadhwani wrote:
> > Hi there,
> >
> > I am trying to use the example given in
> >
> > https://developer.mozilla.org/en-US/docs/Web/API/MozAlarmsManager.getAll
> >
> > for one of my bugs, and it seems that it returns a different id
> everytime I try to get alarm.id  and returns the current time in
> alarm.date.toString().
>
> Could you paste example code of what your script is doing. If you are
> using the result of add(), it will be a new ID every time.
> >
> > Also, this link https://wiki.mozilla.org/WebAPI/AlarmAPI says "No, the
> getAll(...) only returns the alarms scheduled by the application. "  If it
> only returns the alarms added by the app itself, then what would be the
> correct procedure to get the Alarm from the clock app. Will I have to use
> alarmdb.js to retrieve them?
>
> Apps are bound by the same-origin policy, just like normal web pages.
> Which means you cannot access anything the clock app is doing from another
> app. If you really need to get the list of alarms added by the clock app,
> you'll have to add Inter-App Communication API support to the clock, get it
> landed in Gaia (with a requisite justification of strong enough use cases
> for this feature) and then have your app talk to clock over IAC.
>
> Regards,
> Nikhil
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to