语言

Menu
Sites
Language
GearS2 S Health step count

Hello!

I am trying to get steps count on Samsung Gear S2 for my Gear App.
And could not find the way how to get step count same as in S Health.
I have read all Tizen documents for Gear. Tried all methods, but nothing.
 
I have read that I should use stepCountDifferences for it.
 
I have used all methods, and read stepCountDifferences in all of them, and every there it only 1 element in the array ( looks like with difference between current and last data)

function onPedometerUpdate(pedometerData) {
  var d = pedometerData.stepCountDifferences[0];
  barmsg = pedometerData.stepCountDifferences.length +':'+ d.stepCountDifference +':'+ d.timestamp; // 1:1:1455707460
}

tizen.humanactivitymonitor.setAccumulativePedometerListener(onPedometerUpdate);

tizen.humanactivitymonitor.start('PEDOMETER', onPedometerUpdate);

tizen.humanactivitymonitor.getHumanActivityData('PEDOMETER', onPedometerUpdate, null); 
 

Looks like I'm use this attribute stepCountDifferences in wrong way. I very much ask you to tell how to use it in correct way.

 
Thank you.

响应

8 回复
daniel kim

Hi,

I think that you can get step count using following code.

function onchangedCB(pedometerInfo)
 {
    console.log("Step status : " + pedometerInfo.stepStatus);
    console.log("Speed : " + pedometerInfo.speed);
    console.log("Walking frequency : " + pedometerInfo.walkingFrequency);
    console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
   
   
    /* Unregisters a previously registered listener */
    tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
 }

 tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);

Regards

AVSukhov

Hello,

As daniel kim say, try to use "accumulativeTotalStepCount" property of HumanActivityPedometrData interface.

Dr. Shu

Hi.
Strange, didn't get notifications of your answers.
Thanks, but it is wrong. It will give you total steps count from time since Gear was booted, not from midnight of currect day as you see in SHealth.

Antonio Baldassarre

Did you solve this?

I've the same issue. I see somewhere suggestion to use stepdifference... but looking to what sone watchfaces are doing with correct step number immediatelly after installation I'm quite sure that a different method (maybe undocumented) should be available.

Thanks.

 

Dr. Shu

Still nothing (

Somehow other developers did Watch Faces with correct step count. For example 'DSS Simple'.

How to do the same?

Jader Carvalho de Medeiros

Anyone solved this issue? I have the same problem here.

Hi. Unfortunately, it's impossible to solve the issue. We are not allowed to get S Health data from a standalone app. It's impossible only either to create your own counter (it won't have the same number as S health counter has) or to develop a companion app for android phone which will get S Health data from Android S Health and send the data throught bluetooth to your app on the watch. And even there are some constraints which we are not allowed to overcome.