I'm developing an application for the Gera2 Neo smartwatch. When I press a button, the application should read continuously the accelerometer data. The problem I have is that the devicemotion event is not always triggered.
I use this statement to add the handler event:
window.addEventListener("devicemotion",getMontionData,true);
While the application main window is displayed, the devicemotion event is triggered. In this case, it works properly. The problem is raised when the device screen goes on black or when I press the hw-back-key. Then, the getMontionData function is not called. It seems like the devicemontion event was not triggered.
So, could anyone help me how to resolve it? So, I would like is that the devicemotion was continuously triggering even though the screen is on black or I press the hw-back-key and the getMotionData function was called
getMontionData = function (e)
{
xAcceleration = e.acceleration.x;
yAcceleration = e.acceleration.y;
zAcceleration = e.acceleration.z;
console.log("x: " + xAcceleration);
console.log("y: " + yAcceleration);
console.log("z: " + zAcceleration);
}
to get the acceleration data.
I also set up the background setting (<tizen:setting background-support="enable"/>)
Thank so much,
Álvaro