-
Notifications
You must be signed in to change notification settings - Fork 243
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 #232 from magus/dev/noah/fitness-saveWalkingRunnin…
…gDistance feat: AppleHealthKit.saveWalkingRunningDistance
- Loading branch information
Showing
8 changed files
with
77 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
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,36 @@ | ||
# saveWalkingRunningDistance | ||
|
||
Save a walking + running distance sample. | ||
|
||
A distance sample represents the amount traveled during a specific period of time. A sample should be a precise as possible, with `startDate` and `endDate` representing the range of time the steps were taken in. The unit of distance can be specified by `units` key in `options` below, defaulting to meters. | ||
|
||
Example input options: | ||
|
||
```javascript | ||
// 300m over 5 min ~= 1 m/s (walking speed) | ||
let options = { | ||
value: 300, // meters (default) | ||
startDate: new Date(2022, 6, 11, 6, 0, 0).toISOString(), | ||
endDate: new Date(2016, 6, 11, 6, 5, 0).toISOString(), | ||
} | ||
``` | ||
|
||
Call the method: | ||
|
||
```javascript | ||
AppleHealthKit.saveWalkingRunningDistance( | ||
(options: HealthInputOptions), | ||
(err: Object, results: number) => { | ||
if (this._handleHKError(err, 'saveWalkingRunningDistance')) { | ||
return | ||
} | ||
// walking + running distance sample successfully saved | ||
}, | ||
) | ||
``` | ||
|
||
Example output: | ||
|
||
```json | ||
300 | ||
``` |
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