Commit 950fe096 authored by Terrillo Walls's avatar Terrillo Walls

More docs updates..

parent cc7cb345
# React Native Apple Healthkit # React Native Apple Healthkit
A React Native bridge module for interacting with Apple Healthkit data. Checkout the [full documentation](https://github.com/terrillo/rn-apple-healthkit/wiki) A React Native bridge module for interacting with Apple Healthkit data. Checkout the [full documentation](https://github.com/terrillo/rn-apple-healthkit/tree/master/docs)
## Installation ## Installation
...@@ -80,6 +80,11 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => ...@@ -80,6 +80,11 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
0.6.4v 0.6.4v
- Basal energy ([#23](https://github.com/terrillo/rn-apple-healthkit/pull/23)) - Basal energy ([#23](https://github.com/terrillo/rn-apple-healthkit/pull/23))
- Fixed issues with saving weight in the past - Fixed issues with saving weight in the past
- Commited the docs to increase pull request support
- Add daily samples for:
- Flights Climbed
- WalkingRunning Distance
- Cycling Distance
0.6.3v 0.6.3v
- Food and Water ([#19](https://github.com/terrillo/rn-apple-healthkit/pull/19)) - Food and Water ([#19](https://github.com/terrillo/rn-apple-healthkit/pull/19))
...@@ -105,8 +110,8 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => ...@@ -105,8 +110,8 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
* [getBloodPressureSamples](/docs/getbloodpressuresamples().md) * [getBloodPressureSamples](/docs/getbloodpressuresamples().md)
* [getBodyTemperatureSamples](/docs/getbodytemperaturesamples().md) * [getBodyTemperatureSamples](/docs/getbodytemperaturesamples().md)
* [getDailyDistanceCyclingSamples]() * [getDailyDistanceCyclingSamples]()
* [getDailyDistanceWalkingRunningSamples]() * [getDailyDistanceWalkingRunningSamples](/docs/getDailyDistanceWalkingRunningSamples().md)
* [getDailyFlightsClimbedSamples]() * [getDailyFlightsClimbedSamples](/docs/getDailyFlightsClimbedSamples().md)
* [getDailyStepCountSamples](/docs/getDailyStepCountSamples().md) * [getDailyStepCountSamples](/docs/getDailyStepCountSamples().md)
* [getDateOfBirth](/docs/getDateOfBirth().md) * [getDateOfBirth](/docs/getDateOfBirth().md)
* [getDistanceCycling](/docs/getdistancecycling().md) * [getDistanceCycling](/docs/getdistancecycling().md)
......
# React Native Apple Healthkit
A React Native bridge module for interacting with [Apple Healthkit](https://developer.apple.com/Healthkit/) data.
* Base Methods
* [isAvailable](https://github.com/terrillo/rn-apple-healthkit/wiki/isAvailable())
* [initHealthKit](https://github.com/terrillo/rn-apple-healthkit/wiki/initHealthKit())
* Realtime Methods
* [initStepCountObserver](https://github.com/terrillo/rn-apple-healthkit/wiki/initStepCountObserver())
* Read Methods
* [getBiologicalSex](https://github.com/terrillo/rn-apple-healthkit/wiki/getBiologicalSex())
* [getBloodGlucoseSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodglucosesamples())
* [getBloodPressureSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodpressuresamples())
* [getBodyTemperatureSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getbodytemperaturesamples())
* [getDailyStepCountSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getDailyStepCountSamples())
* [getDateOfBirth](https://github.com/terrillo/rn-apple-healthkit/wiki/getDateOfBirth())
* [getDistanceCycling](https://github.com/terrillo/rn-apple-healthkit/wiki/getdistancecycling())
* [getDistanceWalkingRunning](https://github.com/terrillo/rn-apple-healthkit/wiki/getDistanceWalkingRunning())
* [getFlightsClimbed](https://github.com/terrillo/rn-apple-healthkit/wiki/getflightsclimbed())
* [getHeartRateSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getheartratesamples())
* [getHeightSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getheightsamples())
* [getLatestBmi](https://github.com/terrillo/rn-apple-healthkit/wiki/getlatestbmi())
* [getLatestBodyFatPercentage](https://github.com/terrillo/rn-apple-healthkit/wiki/getlatestbodyfatpercentage())
* [getLatestHeight](https://github.com/terrillo/rn-apple-healthkit/wiki/getlatestheight())
* [getLatestLeanBodyMass](https://github.com/terrillo/rn-apple-healthkit/wiki/getlatestleanbodymass())
* [getLatestWeight](https://github.com/terrillo/rn-apple-healthkit/wiki/getlatestweight())
* [getRespiratoryRateSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getrespiratoryratesamples())
* [getSleepSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getsleepsamples())
* [getStepCount](https://github.com/terrillo/rn-apple-healthkit/wiki/getStepCount())
* [getWeightSamples](https://github.com/terrillo/rn-apple-healthkit/wiki/getweightsamples())
* Write Methods
* [saveBmi](https://github.com/terrillo/rn-apple-healthkit/wiki/savebmi())
* [saveHeight](https://github.com/terrillo/rn-apple-healthkit/wiki/saveheight())
* [saveMindfulSession](https://github.com/terrillo/rn-apple-healthkit/wiki/saveMindfulSession())
* [saveWeight](https://github.com/terrillo/rn-apple-healthkit/wiki/saveweight())
* [saveSteps](https://github.com/terrillo/rn-apple-healthkit/wiki/saveSteps())
a
\ No newline at end of file
...@@ -9,7 +9,7 @@ let options = { ...@@ -9,7 +9,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getActiveEnergyBurned(options: Object, (err: Object, results: Object) => { AppleHealthKit.getActiveEnergyBurned(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -7,7 +7,7 @@ let options = { ...@@ -7,7 +7,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getBasalEnergyBurned(options: Object, (err: Object, results: Object) => { AppleHealthKit.getBasalEnergyBurned(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -8,7 +8,7 @@ Get the biological sex (gender). If the `BiologicalSex` read permission is missi ...@@ -8,7 +8,7 @@ Get the biological sex (gender). If the `BiologicalSex` read permission is missi
| other | HKBiologicalSexOther | | other | HKBiologicalSexOther |
```javascript ```javascript
AppleHealthkit.getBiologicalSex(null, (err: Object, results: Object) => { AppleHealthKit.getBiologicalSex(null, (err: Object, results: Object) => {
if (this._handleHealthkitError(err, 'getBiologicalSex')) { if (this._handleHealthkitError(err, 'getBiologicalSex')) {
return; return;
} }
......
...@@ -13,7 +13,7 @@ Available units are: `'mmolPerL'`, `'mgPerdL'`. ...@@ -13,7 +13,7 @@ Available units are: `'mmolPerL'`, `'mgPerdL'`.
The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields
```javascript ```javascript
AppleHealthkit.getBloodGlucoseSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getBloodGlucoseSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -12,7 +12,7 @@ let options = { ...@@ -12,7 +12,7 @@ let options = {
The callback function will be called with a `samples` array containing objects with *bloodPressureSystolicValue*, *bloodPressureDiastolicValue*, *startDate*, and *endDate* fields The callback function will be called with a `samples` array containing objects with *bloodPressureSystolicValue*, *bloodPressureDiastolicValue*, *startDate*, and *endDate* fields
```javascript ```javascript
AppleHealthkit.getBloodPressureSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getBloodPressureSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -14,7 +14,7 @@ Available units are: `'fahrenheit'`, `'celsius'`. ...@@ -14,7 +14,7 @@ Available units are: `'fahrenheit'`, `'celsius'`.
The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields. The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields.
```javascript ```javascript
AppleHealthkit.getBodyTemperatureSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getBodyTemperatureSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
```javascript
let options = {
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
};
```
```javascript
AppleHealthKit.getDailyDistanceCyclingSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
return;
}
console.log(results)
});
```
```javascript
let options = {
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
};
```
```javascript
AppleHealthKit.getDailyDistanceWalkingRunningSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
return;
}
console.log(results)
});
```
```javascript
let options = {
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
};
```
```javascript
AppleHealthKit.getDailyFlightsClimbedSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
return;
}
console.log(results)
});
```
...@@ -9,7 +9,7 @@ let options = { ...@@ -9,7 +9,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getDailyStepCountSamples(options: Object, (err: Object, results: Array<Object>) => { AppleHealthKit.getDailyStepCountSamples(options: Object, (err: Object, results: Array<Object>) => {
if (this._handleHealthkitError(err, 'getDailyStepCountSamples')) { if (this._handleHealthkitError(err, 'getDailyStepCountSamples')) {
return; return;
} }
......
...@@ -2,7 +2,7 @@ Get the date of birth. ...@@ -2,7 +2,7 @@ Get the date of birth.
On success, the callback function will be provided with a `res` object containing dob `value: string` (ISO timestamp), and `age: number` (age in years): On success, the callback function will be provided with a `res` object containing dob `value: string` (ISO timestamp), and `age: number` (age in years):
```javascript ```javascript
AppleHealthkit.getDateOfBirth(null, (err: Object, results: Object) => { AppleHealthKit.getDateOfBirth(null, (err: Object, results: Object) => {
if (this._handleHealthkitError(err, 'getDateOfBirth')) { if (this._handleHealthkitError(err, 'getDateOfBirth')) {
return; return;
} }
......
...@@ -9,7 +9,7 @@ let options = { ...@@ -9,7 +9,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getDistanceCycling(options: Object, (err: Object, results: Object) => { AppleHealthKit.getDistanceCycling(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -10,7 +10,7 @@ let options = { ...@@ -10,7 +10,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getDistanceWalkingRunning(options: Object, (err: Object, results: Object) => { AppleHealthKit.getDistanceWalkingRunning(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -8,7 +8,7 @@ let options = { ...@@ -8,7 +8,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getFlightsClimbed(options: Object, (err: Object, results: Object) => { AppleHealthKit.getFlightsClimbed(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -11,7 +11,7 @@ let options = { ...@@ -11,7 +11,7 @@ let options = {
The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields
```javascript ```javascript
AppleHealthkit.getHeartRateSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getHeartRateSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -10,7 +10,7 @@ let options = { ...@@ -10,7 +10,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getHeightSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getHeightSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -2,7 +2,7 @@ Get the most recent BMI sample. ...@@ -2,7 +2,7 @@ Get the most recent BMI sample.
On success, the callback function will be provided with a `bmi` object containing the BMI `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as bmi samples are saved at a specific point in time.* On success, the callback function will be provided with a `bmi` object containing the BMI `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as bmi samples are saved at a specific point in time.*
```javascript ```javascript
AppleHealthkit.getLatestBmi(null, (err: string, results: Object) => { AppleHealthKit.getLatestBmi(null, (err: string, results: Object) => {
if (err) { if (err) {
console.log("error getting latest bmi data: ", err); console.log("error getting latest bmi data: ", err);
return; return;
......
...@@ -3,7 +3,7 @@ Get the most recent body fat percentage. The percentage value is a number betwee ...@@ -3,7 +3,7 @@ Get the most recent body fat percentage. The percentage value is a number betwee
On success, the callback function will be provided with a `bodyFatPercentage` object containing the body fat percentage `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as bodyFatPercentage samples are saved at a specific point in time.* On success, the callback function will be provided with a `bodyFatPercentage` object containing the body fat percentage `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as bodyFatPercentage samples are saved at a specific point in time.*
```javascript ```javascript
AppleHealthkit.getLatestBodyFatPercentage(null, (err: Object, results: Object) => { AppleHealthKit.getLatestBodyFatPercentage(null, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -3,7 +3,7 @@ Get the most recent height value. ...@@ -3,7 +3,7 @@ Get the most recent height value.
On success, the callback function will be provided with a `height` object containing the height `value`, and the `startDate` and `endDate` of the height sample. *Note: startDate and endDate will be the same as height samples are saved at a specific point in time.* On success, the callback function will be provided with a `height` object containing the height `value`, and the `startDate` and `endDate` of the height sample. *Note: startDate and endDate will be the same as height samples are saved at a specific point in time.*
```javascript ```javascript
AppleHealthkit.getLatestHeight(null, (err: string, results: Object) => { AppleHealthKit.getLatestHeight(null, (err: string, results: Object) => {
if (err) { if (err) {
console.log("error getting latest height: ", err); console.log("error getting latest height: ", err);
return; return;
......
...@@ -3,7 +3,7 @@ Get the most recent lean body mass. The value is a number representing the weigh ...@@ -3,7 +3,7 @@ Get the most recent lean body mass. The value is a number representing the weigh
On success, the callback function will be provided with a `leanBodyMass` object containing the leanBodyMass `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as leanBodyMass samples are saved at a specific point in time.* On success, the callback function will be provided with a `leanBodyMass` object containing the leanBodyMass `value`, and the `startDate` and `endDate` of the sample. *Note: startDate and endDate will be the same as leanBodyMass samples are saved at a specific point in time.*
```javascript ```javascript
AppleHealthkit.getLatestLeanBodyMass(null, (err: Object, results: Object) => { AppleHealthKit.getLatestLeanBodyMass(null, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -9,7 +9,7 @@ let options = { ...@@ -9,7 +9,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getLatestWeight(options, (err: string, results: Object) => { AppleHealthKit.getLatestWeight(options, (err: string, results: Object) => {
if (err) { if (err) {
console.log("error getting latest weight: ", err); console.log("error getting latest weight: ", err);
return; return;
......
...@@ -13,7 +13,7 @@ let options = { ...@@ -13,7 +13,7 @@ let options = {
The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields The callback function will be called with a `samples` array containing objects with *value*, *startDate*, and *endDate* fields
```javascript ```javascript
AppleHealthkit.getRespiratoryRateSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getRespiratoryRateSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -20,7 +20,7 @@ The callback function will be called with a `samples` array containing objects ...@@ -20,7 +20,7 @@ The callback function will be called with a `samples` array containing objects
with *value*, *startDate*, and *endDate* fields with *value*, *startDate*, and *endDate* fields
```javascript ```javascript
AppleHealthkit.getSleepSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getSleepSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -9,7 +9,7 @@ let options = { ...@@ -9,7 +9,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getStepCount(options: Object, (err: Object, results: Object) => { AppleHealthKit.getStepCount(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -11,7 +11,7 @@ let options = { ...@@ -11,7 +11,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.getWeightSamples(options, (err: Object, results: Array<Object>) => { AppleHealthKit.getWeightSamples(options, (err: Object, results: Array<Object>) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -8,7 +8,7 @@ listen to the NativeAppEventEmitter `change:steps` event and re-fetch relevent ...@@ -8,7 +8,7 @@ listen to the NativeAppEventEmitter `change:steps` event and re-fetch relevent
step count data in the event handler. step count data in the event handler.
The `initStepCountObserver` method should be called after Healthkit has been The `initStepCountObserver` method should be called after Healthkit has been
successfully initialized (AppleHealthkit.initHealthKit has been called without successfully initialized (AppleHealthKit.initHealthKit has been called without
error). error).
```javascript ```javascript
......
Check for Healthkit availability Check for Healthkit availability
```javascript ```javascript
import AppleHealthkit from 'rn-apple-healthkit'; import AppleHealthKit from 'rn-apple-healthkit';
AppleHealthKit.isAvailable((err: Object, available: boolean) => { AppleHealthKit.isAvailable((err: Object, available: boolean) => {
if (err) { if (err) {
......
...@@ -7,7 +7,7 @@ let options = { ...@@ -7,7 +7,7 @@ let options = {
} }
``` ```
```javascript ```javascript
AppleHealthkit.saveBmi(options: Object, (err: Object, results: Object) => { AppleHealthKit.saveBmi(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -8,7 +8,7 @@ let options = { ...@@ -8,7 +8,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.saveHeight(options: Object, (err: Object, results: Object) => { AppleHealthKit.saveHeight(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
return; return;
} }
......
...@@ -14,7 +14,7 @@ let options = { ...@@ -14,7 +14,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.saveSteps(options, (err, res) => { AppleHealthKit.saveSteps(options, (err, res) => {
if (this._handleHKError(err, 'saveSteps')) { if (this._handleHKError(err, 'saveSteps')) {
return; return;
} }
......
...@@ -8,7 +8,7 @@ let options = { ...@@ -8,7 +8,7 @@ let options = {
``` ```
```javascript ```javascript
AppleHealthkit.saveWeight(options: Object, (err: Object, results: Object) => { AppleHealthKit.saveWeight(options: Object, (err: Object, results: Object) => {
if (err) { if (err) {
console.log("error saving weight to Healthkit: ", err); console.log("error saving weight to Healthkit: ", err);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment