12-09-2019 19:29 - edited 12-09-2019 19:58
12-09-2019 19:29 - edited 12-09-2019 19:58
I targeted my Versa device from Fitbit Studio and am using SDK 4. In package.json, I checked the boxes for Activity, User profile, and Heart rate. I can get and display data from user-profile and show the current time.
But both today.local and today.adjusted are undefined. I am already checking if the "access_activity" permission is granted.
import clock from "clock";
import document from "document";
import { me as appbit } from 'appbit';
import { today } from "user-activity";
import { user } from "user-profile";
clock.ontick = (evt) => {
// clock stuff here (this works) Edit: I had today = evt.date here which re-assigns var!
console.log((user.restingHeartRate || "Unknown") + " BPM"); // this works
if (appbit.permissions.granted("access_activity")) {
console.log(today.local); // undefined
}
}
I'm stumped!
Answered! Go to the Best Answer.
12-09-2019 19:56
12-09-2019 19:56
Nevermind! The 'today' variable was being overwritten by let today = evt.date; which I had copied from the Getting Started tutorial. Changing that to use a different variable name fixed my problem.
12-09-2019 19:56
12-09-2019 19:56
Nevermind! The 'today' variable was being overwritten by let today = evt.date; which I had copied from the Getting Started tutorial. Changing that to use a different variable name fixed my problem.