01-14-2019 11:26
01-14-2019 11:26
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.
01-14-2019 13:21
01-14-2019 13:21
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
}
})
01-14-2019 13:21
01-14-2019 13:21
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
}
})
01-14-2019 14:02
01-14-2019 14:02
Thank 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?
01-14-2019 14:05
01-14-2019 14:05
It's fired for all goals, you just need to determine which have been met.
01-15-2019 10:05
01-15-2019 10:05
Thanks, it works perfectly on my Versa!