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

ActiveZoneMinutes Goals

ANSWERED

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.

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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`);

 

 

 

View best answer in original post

Best Answer
3 REPLIES 3

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`);

 

 

 

Best Answer

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!

Best Answer
0 Votes

Thanks a lot. I was currently struggling with this topic, too. This solved the problem.

Thanks

Capitano

Best Answer
0 Votes