09-24-2020 10:00
09-24-2020 10:00
Hi,
Is there a way to programmatically access the ActiveZoneMinutes goals similar to the way Steps goals are accessed (i.e userActivity.goals.steps)? I'm using progress arcs to depict the completion of my daily goals and I keep getting errors when I try using ActiveZoneMinutes goals.
I've tried:
userActivity.goals.ActiveMinutes (depricated now?)
userActivity.goals.ActiveZoneMinutes (out of bounds error)
userActivity.goals.ActiveZoneMinutes.total (cannot read property - total)
I'm now hard coding a number there just to get it to work, but I'd like to try and access my actual goal value. I've searched the forum and read through the reference documentation, but I'm unable to find an answer. Please help.
Answered! Go to the Best Answer.
09-24-2020 10:39 - edited 09-24-2020 10:40
09-24-2020 10:39 - edited 09-24-2020 10:40
It's in the blog post: https://dev.fitbit.com/blog/2020-09-10-announcing-fitbit-os-sdk-4.2/#user-activity-api-active-zone-m...
import { goals, today } from "user-activity";
console.log(`${goals.activeZoneMinutes.total} activeZoneMinutes Goal`);
09-24-2020 10:39 - edited 09-24-2020 10:40
09-24-2020 10:39 - edited 09-24-2020 10:40
It's in the blog post: https://dev.fitbit.com/blog/2020-09-10-announcing-fitbit-os-sdk-4.2/#user-activity-api-active-zone-m...
import { goals, today } from "user-activity";
console.log(`${goals.activeZoneMinutes.total} activeZoneMinutes Goal`);
09-24-2020 11:35
09-24-2020 11:35
Thanks very much, Jon!
I had tried that, but was getting a 'cannot read property - total' error. I cut and pasted the code from above and it's working now. Many thanks - not sure what my typo was!
09-24-2020 22:02
09-24-2020 22:02
Thanks a lot. I was currently struggling with this topic, too. This solved the problem.
Thanks
Capitano