Search code examples
tizen-wearable-sdktizen-web-app

How can I keep the sensorListener keep listening while display is off in tizen?


I am writing a webapp for the Samsung Gear S3, which listens to several Sensors. when the Display is switched off, the sensorListener stops listening. the Listener is started by this function:

void setChangeListener(SensorDataSuccessCallback successCallback, 
                        optional long? interval, optional long batchLatency);

the batchLatency parameter is meant to keep the interval in which the sensor delivers data to the app when the processor is in sleep or suspend mode, but the S3 doesn't support this feature. Has anyone dealt with this yet?


Solution

  • These two lines make a good workaround:

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

    they just prevent the screen from switching off.