-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from Nesh108/master
Added `saveHeartRateSample` to the library
- Loading branch information
Showing
7 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# saveHeartRateSample | ||
|
||
Save a Heart Rate sample to Healthkit | ||
|
||
`saveHeartRateSample` accepts an options object containing a numeric heart rate value in Beats per minute (BPM). | ||
In the example below a heart rate sample of 72BPM is added to Healthkit. | ||
|
||
Example input options: | ||
|
||
```javascript | ||
let options = { | ||
value: 72, // Amount in BPM | ||
date: (new Date(2018,10,1)).toISOString(), // Optional, time when the Heart Rate was logged | ||
} | ||
``` | ||
|
||
Call the method: | ||
|
||
```javascript | ||
AppleHealthKit.saveHeartRateSample((options: Object), (err: Object, results: boolean) => { | ||
if (err) { | ||
console.log('Error saving Heart Rate to Healthkit: ', err) | ||
return | ||
} | ||
// Heart Rate successfully saved | ||
}) | ||
``` | ||
|
||
Example output: | ||
|
||
```json | ||
1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters