You can probably use the Page visibility API. It will tell you when your
app is visible or not. This is a bit different than your question but I
believe that it's useful for your use case.
https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API
On 26/06/13 17:47, [email protected] wrote:
How do you test from a web app if the screen is off?
I made small test app that reads the GPS regularly, however, judging by power
consumption, it was still busy reading the GPS and updating its UI while the
screen was off.
I spotted that behavior in both FireFox OS and FireFox for Android (this was a
regular web app, loaded from the web).
Assuming the above isn't a bug and that the browser shouldn't have put my app
to sleep on its own, is there an equivalent to the PowerManager WebAPI that
would give read-only access to screen on/off state, but without requiring
permissions?
Ideally I would need an event to put everything to sleep and another to wake
the UI.
Eric
_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps