11-09-2017 00:31
11-09-2017 00:31
I'm really wondering if this is just me.
But I have a all in one kind of watch face that displays heart rate, steps and calories when the display comes on. It was working fine before the update.
So I went through the changelog, and some backstory. Even before permissions were being required, my package.json had requested appropriate permissions.
After fixing the depreciated warnings for inner text, I find the step count and the calorie count are now completely incorrect random numbers.
Code:
stepLabel.text = util.fixSteps(today.local.steps);
fixSteps is basically a small helper function to add a "," to format the thousands. I confirmed on the today page on the ionic that the steps for today was over 11,000 but the clock face reported only 2512. Caloried burned never changed.
calLabel.text = util.fixSteps(today.local.calories);
Also maybe of significance, I used my blaze for a lot of my activities today, as I use it for rigorous sport (not wanting to damage my ionic). I may have only done 2512 steps on the ionic with the rest coming from the blaze. However, prior to this update, this was never a problem.
Any confirmation from the dev team as to whats going on ? If what I suspect is the case, there must be a fix for getting the total steps.
Answered! Go to the Best Answer.
11-09-2017 07:38
11-09-2017 07:38
Please create a new app, add the user activity permission, then put this code in it:
import { today } from "user-activity"; console.log((today.local.steps || 0) + " steps");
console.log((today.adjusted.steps || 0) + " steps");
What values does that return compared to the values you see in the mobile app?
11-09-2017 07:00 - edited 11-09-2017 07:02
11-09-2017 07:00 - edited 11-09-2017 07:02
Just a quick mention that there is actually a built in too in Javascript to handle formatting the numbers.
.toLocaleString()
as in:
stepGoalLabel.text = goals.steps.toLocaleString();
11-09-2017 07:18
11-09-2017 07:18
I would also try a reboot, I think someone on Discord mentioned the same issue.
11-09-2017 07:29
11-09-2017 07:29
That was actually me. Reboot did not help.
11-09-2017 07:38
11-09-2017 07:38
Please create a new app, add the user activity permission, then put this code in it:
import { today } from "user-activity"; console.log((today.local.steps || 0) + " steps");
console.log((today.adjusted.steps || 0) + " steps");
What values does that return compared to the values you see in the mobile app?
11-09-2017 18:03
11-09-2017 18:03
Ok since most of today I was wearing the same tracker, both the steps were the same, till I switched the trackers just to test and they became different again.
So as I suspected, the today.local object stores data from the tracker only, while today.adjusted has information from all trackers linked to the account ?
So a simple change makes the script work. Maybe the documentation needs to be updated to include this new information.
Thanks
11-10-2017 10:35
11-10-2017 10:35
Adjusted is the server's value, local is the device's value. The server value has additional processing.
The docs do already cover this https://dev.fitbit.com/reference/device-api/user-activity/#interface-today-