Firefox for Android should support Navigator.requestWakeLock API

NEW
Unassigned

Status

()

P5
normal
5 years ago
28 days ago

People

(Reporter: wlach, Unassigned)

Tracking

unspecified
ARM
Android
Points:
---

Firefox Tracking Flags

(fennec+)

Details

(Whiteboard: [lang=js])

I recently wrote up a meditation application and uploaded it to the Firefox marketplace:

https://marketplace.firefox.com/app/meditation

Unfortunately it doesn't work particularly well on Android, because the screen turns off while the timer is counting down and the end "chime" sound never plays. On FirefoxOS, I used the requestWakeLock API to avoid this problem:

https://developer.mozilla.org/en-US/docs/Web/API/Navigator.requestWakeLock API

... it would be great if Firefox for Android supported this as well.
tracking-fennec: --- → ?
This should be trivial. Add the wakelock pref (dom.wakelock.enabled) to the list of things to turn on in apps:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/WebappRT.js#27

If you have time/environment to do that, you're in a much better place to test the api than anyone else :)
Mentor: wjohnston
(In reply to Wesley Johnston (:wesj) from comment #1)
> This should be trivial. Add the wakelock pref (dom.wakelock.enabled) to the
> list of things to turn on in apps:
> 
> http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/
> WebappRT.js#27
> 
> If you have time/environment to do that, you're in a much better place to
> test the api than anyone else :)

I wonder if this should be usable by regular web pages as well though? As long as release the lock when the webpage is left, we should be fine, right? This is the way it works for FirefoxOS.
Flags: needinfo?(wjohnston)
Hmm... that would be interesting. I don't know enough about the topic to comment. Probably a good dev-platform post to see what people think.

The fix should also try and make sure the apk factory is updated to include the wake_lock pref is apps request it:
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Flags: needinfo?(wjohnston)
tracking+ for now, but we can track for a release if we decide to do a webapp API-focused release.
tracking-fennec: ? → +
filter on [mass-p5]
Priority: -- → P5
Sounds like fixing this bug would just involve flipping a pref and doing some testing.
Whiteboard: [lang=js]
(In reply to :Margaret Leibovic from comment #6)
> Sounds like fixing this bug would just involve flipping a pref and doing
> some testing.

Yup, I think so. I really haven't had the time/inclination to work on it myself, but it would likely make a good first bug for someone who wants to get started. To test that it works, maybe just install my meditation app (https://marketplace.firefox.com/app/meditation/) and do a 5 minute session. Make sure the screen stays on for the duration.
There is now a W3C API for wake lock management: http://w3c.github.io/wake-lock/

It has been added an experimental feature in Chromium: https://codereview.chromium.org/1107333002/
Mentor: wjohnston2000
You need to log in before you can comment on or make changes to this bug.