Out application is for samsung watch gear s3. I already tried following code:
function onchangedCB(pedometerInfo) {
console.log('accumulativeTotalStepCount: ' + pedometerInfo.accumulativeTotalStepCount);
tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
}
tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
I also tried:
tizen.humanactivitymonitor.start("PEDOMETER",
function onSuccess(pedometerInfo) {
console.log(pedometerInfo.cumulativeTotalStepCount)
}
);
function onsuccessCB(pedometerInfo) {
console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
}
function onerrorCB(error) {
console.log("Error occurs. name:"+error.name + ", message: "+error.message);
}
tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
getHumanActivityData is returning data right away but unable to get accumulativeTotalStepCount.
Unfortunately you cannot achieve your goal using humanactivity web API. As it stays in setAccumulativePedometerListener() API reference is is used to register listener for change of data ('when new data is available'). This makes clear that it is not your use-case.
getHumanActivityData() function is designed for returning the data since the latest call of start() for this sensor, which also does not meet your expectations about total steps count (accumulated).
I can only suggest you some workaround with getting accumulativeTotalStepCount when available in your application and cache it when closing your application. Then until your application will gather updated data, the result will be approximately accurate. And updated after first listener call.
EDIT: Necessary data is not available from Web API, but it could be provided using native API. You can also refer to hybrid application concept which uses Web application and native service which communicate with app and provides data