When I hit my steps goal for the day my Venu (and VA3 before that) shows a nifty little animation showing the count of days -“43” or whatever days my step goal streak is at.
(actually today it was “6” but I have seen higher numbers in the past when I had extended streaks)
HOWEVER it seems like this value is not available for apps/watch faces to accces. - I would love to be wrong here which would make the rest of this post irrelevant!)
I would really like to have that number displayed on a watchface that I have started coding and thought I would share an outline of the method I have come up with and see if anyone has any comments.
My understanding is that
A) Watchfaces can “see” todays steps vs goals and the history for the previous 7 days.
B)Watchfaces can store values in persistent storage
Method
- Look at available history if there is a day where goal has not been met then the day after (the most recent missed day) becomes the start of a streak.
- If there is no missed goals in the last 7 days then assume the streak started 7 days ago.
- Store this value of the date in persistent memory.
- Now that there is a value there - use this date - UNTIL we detect a day where the goal is missed - (between yesterday and 7 days ago) if that happens reset the stored value.
- Display the number of days as a calculated value (Stored value - yesterday) (+ 1 if we have met goal ‘today”)
The weekness I can see with this is if this watchface is turned off, you miss your goal (and more than 8 days later) the watchface is turned back on then the watchface would not see that miss as it would be aged out of history while it was disabled.
One possible enhancement would be a setting for start date could be passed to populate the persistent storage once - and then the watchface could remove that setting and revert to the method above. That way if you started using this on day 43 of your streak you could make that happen.
Another possible enhancement would be to only run this calculation occasionally so that we don’t repeatedly check these things.
I’m starting to code the above- wondering if anyone has tried anything similar?
Thanks to those who have shared source code etc - Im getting close to a watchface that does exactly what I want it to which is exciting.