I created a watch face for my wife (with her grandkid's picture) for her birthday, and she is really happy with it. It's pretty simple, shows the date/time, the heart rate, and the total steps for the day.
Thank you for opening that up to everyone.
I asked her if she'd like anything else, and she said that she'd like to see how many steps she had taken that hour. It's on the watch already, under "Today". I said "Sure, that must be pretty simple", it's already right there.
But I can't seem to find how to get to that information. Is there an API that I am missing?
There are responses on these threads that suggests that the API doesn't currently support this:
https://community.fitbit.com/t5/SDK-Development/Active-Hours/m-p/2221710
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
You could just store the current step count when the hour ticks, then subtract that from the current step count to give you the steps this hour.
You would need to persist the step count when the hour begins, but once you've done that you should be good.
Something like this (untested):
import clock from "clock";
import { today } from "user-activity";
// you should actually load this from file system
let hourSteps = today.local.steps || 0;
clock.granularity = "minutes";
clock.ontick = function(evt) {
// hour tick
if (evt.date.getMinutes() === 0) {
hourSteps = today.local.steps || 0;
// now write this value to the filesystem
}
console.log((today.local.steps - hourSteps) + " steps this hour");
};
Does this work, when you run another app on the watch during the change of the hour?
Don't think so, because the clockface-app isn't running when another app is active, or am I wrong?
Capitano
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
@Capitano wrote:
Does this work, when you run another app on the watch during the change of the hour?
Don't think so, because the clockface-app isn't running when another app is active, or am I wrong?
Capitano
No, you're correct, it's not a perfect solution.
Best Answer