0

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

genoveseV
  • 61
  • 7

1 Answers1

1

Yes, you can still get the data when app is running in background on pressing the home key.

Please add this in your config.xml

<tizen:setting background-support="enable"/>

This will enable your app to collect data in background as well. :)

Shreeram K
  • 1,719
  • 13
  • 22
  • Hi, I apologise for the big delay in my reply. I forgotten to report that in my config.xml file the privilege was already enclosed. Of course the issue remains. When the screen is OFF the data (Ax,Ay,Az) are not collected. Regards V – genoveseV Oct 12 '15 at 05:42