문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

have you tried to use Worker API ?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top