tizentizen-wearable-sdktizen-web-appsamsung-gear-s2

Using accelerometer in Samsung Gear S2 in background


I'm creating a slidepresenter app that moves the slide using accelerometer. But when I move the watch its display off, and the event isn't handled. How can I get a event display off mode?

Sorry, but I forgot say I'm using Web Application Development.


Solution

  • As the app being Slide Presenter the watch display should not be off while user is moving slides. I would suggest to use Power API to control the display making the app more user friendly.

    void request(PowerResource resource, PowerState state);

    void release(PowerResource resource);

    You may use tizen.power.request() function to request the display to remain on while the app is running.

    tizen.power.request("SCREEN", "SCREEN_NORMAL");
    

    You should consider releasing the lock before exiting from app.

    tizen.power.release("SCREEN");
    

    Add the power privilege in your config.xml file to use the Power API.

    <tizen:privilege name="http://tizen.org/privilege/power"/>
    

    Please check Power State Guide and Power API reference for details Implementation.