Question

I'm developing a Pomodoro Timer app for Firefox OS and I'm having a problem with the execution of it: Once the timer is running the execution is suspended every time the phone goes in low power mode (which is quite typical in my scenario, for the timer runs for 25mins) and is resumed only when the screen is turned on again.

I searched for a way to prevent this, and according to Mozilla docs there are two APIs (Power Management and Idle) by which you could either:

  • Prevent the screen from turning off
  • Be notified when the app goes in low power mode

Unfortunately these APIs are available only for certified apps (the ones shipped with the phone), which basically means you can't use them if you want to publish your app.

Is any of you having the same problem or have a hint on how to solve this?

Was it helpful?

Solution

Privileged apps can use navigator.requestWakeLock.

navigator.requestWakeLock("cpu");

App will never suspend even if the screen is turned off.

Background services API is better, but not implemented yet.

OTHER TIPS

have you tried to use Worker API ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top