Brilliant, thanks Tim!

It's indeed my own system app. I figured Gonk handled this. But great, I'll
rip out the gaia system handlers for wake locks and I should be good to go.

\o/

On Thu, Oct 16, 2014 at 7:11 AM, Tim Chien <[email protected]> wrote:

> Jan, are you working on the current System app or in your own System app?
>
> The wake locks are actually handled in the system app. API does
> nothing but pass the information. Incidentally this is the part I
> happen try to isolate in
> https://bugzilla.mozilla.org/show_bug.cgi?id=1081630
>
>
> On Thu, Oct 16, 2014 at 10:30 AM, Kan-Ru Chen (陳侃如) <[email protected]>
> wrote:
> > Jan Jongboom <[email protected]> writes:
> >
> >> I have the following code running in system:
> >>
> >>     var _iv;
> >>
> >>     navigator.requestWakeLock('cpu');
> >>     navigator.requestWakeLock('screen');
> >>     navigator.requestWakeLock('wifi');
> >
> > Use
> >
> >       var lock = navigator.requestWakeLock('cpu');
> >
> > otherwise the lock is unlocked when GC'ed. Also remember to call
> > lock.unlock() when done using them.
> >
> >>     window.on('online', () => {
> >>       _iv = setInterval(ping, 1500);
> >>     });
> >>     window.on('offline', () => clearInterval(_iv));
> >>
> >>     function ping() {
> >>       var x = new XMLHttpRequest({ mozSystem: true });
> >>       x.open('GET', 'http://janjongboom.com/yolo123?' + (+new Date));
> >>       x.send();
> >>     }
> >>
> >> When I now turn off the screen via |navigator.mozPower.screenEnabled =
> false| it will stop executing my code anyway (need to not be connected to
> USB). It also does not show up anymore in ADB when I re-plug it into USB...
> >>
> >> What am I missing?
> >> _______________________________________________
> >> 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
>
>
>
> --
> Tim Guan-tin Chien, Engineering Manager and Front-end Lead, Firefox
> OS, Mozilla Corp. (Taiwan)
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to