Hi,
I just tested using requestWakeLock on the screen in a privileged app as
well as a hosted app, based on the instructions here:
https://developer.mozilla.org/en-US/docs/Web/API/window.navigator.requestWakeLock

To my surprise in both cases the app was able to obtain a lock and keep the
screen on. Sorry for being so sceptical, but I just want a confirmation
that this is indeed a feature and not a bug. Are webapp developers now able
to enjoy using requestWakeLock API in hosted apps?

The second question I have is about releasing the lock. In the
documentation an example is given that shows you can release the lock like
this:

window.addEventListener('unload', function () {
    lock.unlock();});

I tested this and it seems to work as expected when killing the app. But
there is no guarantee that unload will always fire, so, I went ahead and
removed the unlock code. Again to my surprise, everything seems to work! In
fact it seems that the wakeLock on the screen is automatically released as
soon as the app goes into the background and then is obtained again when it
comes back to foreground. So my question is: do webapps need to release the
lock they obtain if they intent to keep it as long as they are in the
foreground?

If anyone can shed some light on this, I really appreciate it.

~ Aras
blog: *arasbm.com*
github, twitter etc: *arasbm *
_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to