Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Latest commit

 

History

History
26 lines (24 loc) · 904 Bytes

getHeartRateSamples().md

File metadata and controls

26 lines (24 loc) · 904 Bytes

Query for heart rate samples. the options object is used to setup a query to retrieve relevant samples.

let options = {
  unit: 'bpm', // optional; default 'bpm'
  startDate: (new Date(2016,4,27)).toISOString(), // required
  endDate: (new Date()).toISOString(), // optional; default now
  ascending: false, // optional; default false
  limit:10, // optional; default no limit
};

The callback function will be called with a samples array containing objects with value, startDate, and endDate fields

AppleHealthKit.getHeartRateSamples(options, (err: Object, results: Array<Object>) => {
  if (err) {
    return;
  }
  console.log(results)
});
[
	{ value: 74.02, startDate:'2016-06-29T17:55:00.000-0400', endDate:'2016-06-29T17:55:00.000-0400' },
	{ value: 74, startDate:'2016-03-12T13:22:00.000-0400', endDate:'2016-03-12T13:22:00.000-0400' },
]