On Jul 11, 2014 2:11 AM, "Jan Jongboom" <[email protected]> wrote:
>
> Cross post from https://bugzilla.mozilla.org/show_bug.cgi?id=1037362
>
> So I was working on something last week, and also got a question on SO
about this:
http://stackoverflow.com/questions/24674927/firefoxos-cordova-vibration-not-working-if-device-is-locked
>
> navigator.vibrate() doesn't work when the screen is off. Neither do we
get devicemotion events. Makes sense. But I expected that when I acquire a
CPU wakelock this would work.
>
> Is this on purpose?

Yes, I would say this is on purpose.

In part I think it's good to keep a bit of separation of concerns here. The
idea of a CPU lock was to enable applications to perform plain data
processing in the background.

Allowing sensors to run has some privacy implications, so it's good if we
don't have to worry about those when we hand out ability to hold CPU
wakelocks.

Finally, the vibration API was never intended to be used as a notification
mechanism, but rather as just additional output in addition to audio and
video, especially for games. Notifications were intended to be handled by
the notification API, although that definitely has much less control over
the vibration pattern. Maybe we should fix that.

Can I ask what type of thing you are trying to build?

We do actually have a permission for "ability to use sensor API even in
background". That permission should give you ability to use sensors while
holding the CPU lock. Though the permission might only be granted to
privileged apps. And I'm not sure its used much so might no longer work.

/ Jonas
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to