语言

Menu
Sites
Language
Capturing devicemotion events when the screen is switched off.

I have developed an application getting data from the Gear2 accelorometer. The devicemotion events are managed by a window event listener such as:

window.addEventListener('devicemotion', function(e) {
        Ax = e.accelerationIncludingGravity.x / 9.8;
        Ay = e.accelerationIncludingGravity.y / 9.8;
        Az = e.accelerationIncludingGravity.z / 9.8;
});

I need to run the application in background even if the screen is switched off. I adopted the power setup:

 tizen.power.request("SCREEN", "SCREEN_NORMAL");
 tizen.power.request('CPU', 'CPU_AWAKE');

The problem: when the screen is switched off (by means of the Home button) the motion event associated to the window is not fired. I think that if the window is not active then the listener itself is not active.

Somebody has any idea how to get the accelometer data even if the screen is off?

Regards V

响应

1 回复
Vikram

Hello,

This is known issue(please see link) and power setup is workaround so far.

  https://developer.tizen.org/forums/web-application-development/device-motion-event-not-always-triggered