Can somebody please post a little example for an onreachgoal event (e.g. daily steps)?
Does the Fitbit Simulator allow user activity manipulation so that I will be able to test this?
Thanks in advance!
Answered! Go to the Best Answer.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
I don't think you can test in the simulator, but here's a sample:
import { today, goals } from "user-activity";
goals.addEventListener("reachgoal", (goal, evt) => {
if (today.adjusted.steps >= goal.steps) {
// step goal reached
}
})
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
I don't think you can test in the simulator, but here's a sample:
import { today, goals } from "user-activity";
goals.addEventListener("reachgoal", (goal, evt) => {
if (today.adjusted.steps >= goal.steps) {
// step goal reached
}
})
Best AnswerThank you Jon!
Is this event also being fired for active minutes goals, calories goals etc or is it only being fired when the steps goal has been reached?
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
It's fired for all goals, you just need to determine which have been met.
Best Answer