Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Steps this Hour on a Watch Face

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?

Best Answer
5 REPLIES 5
Best Answer
0 Votes

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");
};

 

Best Answer

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
0 Votes

@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
0 Votes

As was stated, there is no good way to do this now.  But for an example implementation, see "Move It!" in the gallery.

 

John

Best Answer