01-03-2020 04:11
01-03-2020 04:11
Hi Fitbit Family,
I want to test the Interface, ActivityHistoryRecord. This is what the reference document says:
"An activity history object represents user activity over some time interval, defined by the interface providing these objects."
This is the url of the document reference: https://dev.fitbit.com/build/reference/device-api/user-activity/#interface-activityhistory
I don't understand, there is no methods associated to this Interface, only properties.
Do you guys have an example that helps me understand how to use this Interface?
Thanks
01-06-2020 08:29
01-06-2020 08:29
The docs are a bit of a mess here. The interface defines what's returned from the query() in ActivityHistory. I'll see about getting the example added to that.
Here's one you can use:
https://dev.fitbit.com/blog/2019-10-29-announcing-fitbit-os-sdk-4.0/#activity-history-api
01-06-2020 10:43
01-06-2020 10:43
Thank you
01-09-2020 23:35
01-09-2020 23:35
Hi,
I´m working with the example: https://dev.fitbit.com/blog/2019-10-29-announcing-fitbit-os-sdk-4.0/#activity-history-api
The properties: distance, steps and calories, work and give me the data correctly.
But the properties: averageHeartRate and RestingHeartRate always return an undefined. The code is below, it is exactly like the one in the example, but maybe I did something wrong. Is there an error?
Also noticed that there is no property named activeMinutes, which is available for the Activity Interface, but not for ActivityHistoryRecord? Are you guys planning to add this property in the future?
// query all days history step data
const dayRecords = dayHistory.query();
dayRecords.forEach((day, index) => {
console.log(`${day.distance || 0} distance. ${index} day(s) ago.`);
console.log(`${day.steps || 0} steps. ${index} day(s) ago.`);
console.log(`${day.calories || 0} calories. ${index} day(s) ago.`);
console.log(`${day.activeMinutes} activeMinutes. ${index} day(s) ago.`);
console.log(`${day.averageHeartRate} averageHeartRate. ${index} day(s) ago.`);
console.log(`${day.restingHeartRate} restingHeartRate. ${index} day(s) ago.`);
});
Thanks in advance
01-10-2020 02:26
01-10-2020 02:26
Is this in the simulator or on a real device?
The activeMinutes property doesn't exist due to the way it's calculated over a 10 minute period of activity.
01-10-2020 04:28
01-10-2020 04:28
Hi Jon,
It is on a real device. I maybe have something wrong in my code... 😞
I can see why the activeMinutes doesn't make sense if we use the query for minutes:
const minuteRecords = minuteHistory.query({ limit: 5 });
But if we use the query for all day:
// query all days history step data const dayRecords = dayHistory.query();
It is a shame that we can´t see the active minutes for the previous days.
Thanks
02-08-2020 02:01
02-08-2020 02:01
Agree - I also wish this was available for previous days.
01-17-2021 07:34
01-17-2021 07:34
Did you ever get a response or figure out why the averageHeartRate and restingHeartRate return undefined? I'm also see the day history returning restingHeartRate as undefined on my Iconic.
08-15-2022 05:42
08-15-2022 05:42
@JonFitbit wrote:Is this in the simulator or on a real device?
Is the activityHistory available in the simulator with dummy values or are the returned values always zero?
Capitano
08-15-2022 13:35
08-15-2022 13:35
Always zero, I think.