02-18-2018 12:05
02-18-2018 12:05
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?
02-19-2018 04:17
02-19-2018 04:17
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
02-19-2018 07:37 - edited 02-19-2018 07:56
02-19-2018 07:37 - edited 02-19-2018 07:56
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");
};
09-07-2018 11:50
09-07-2018 11:50
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
09-07-2018 14:32
09-07-2018 14:32
@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.
09-07-2018 18:13
09-07-2018 18:13
As was stated, there is no good way to do this now. But for an example implementation, see "Move It!" in the gallery.
John