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

ActivityHistoryRecord

I've been trying to use the documentation to get averageHeartRate to return something other than undefined. I have seen from previous post of this same issue but doesn't look like any show a true resolve? Is this something that just doesn't work? Any other variable I can get to return a value expect for AHR.

 

if (appbit.permissions.granted("access_activity")) {
  const dayRecords = dayHistory.query({limit:7});
  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.averageHeartRate} averageHeartRate. ${index} day(s) ago.`);
    console.log(`${day.restingHeartRate} restingHeartRate. ${index} day(s) ago.`);
  });

I've tried this on device and simulator both show the same in the logs. I've tried a range of days from 1-14 and still the same.

 

Thoughts?

Best Answer
0 Votes
1 REPLY 1

Got the access_heart_rate permission?

Peter McLennan
Gondwana Software
Best Answer
0 Votes