From 77978c363b9c374bd6009b1170bc753a7a334785 Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Sat, 9 Jul 2016 12:55:53 -0400 Subject: [PATCH] update readme --- README.md | 25 +++++++++++++++++++ .../StepsDemo/app/components/home/index.js | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3965f99..9ffcd17 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ A React Native bridge module for interacting with [Apple HealthKit] data. * ~~[getStepCountForDay](#getstepcountforday)~~ * [getDailyStepCountSamples](#getdailystepcountsamples) * ~~[getMultiDayStepCounts](#getmultidaystepcounts)~~ + * [saveSteps](#savesteps) * [getDistanceWalkingRunning](#getdistancewalkingrunning) * [getDistanceCycling](#getdistancecycling) * [getFlightsClimbed](#getflightsclimbed) @@ -367,6 +368,30 @@ the function will be called with an array of elements `res` containing date and ___ +#### **`saveSteps`** +save a step count sample. a step count sample represents the number of steps 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. + +`saveSteps` accepts an options object containing required *`value: number`*, *`startDate: ISO8601Timestamp`*, and *`endDate: ISO8601Timestamp`*. +```javascript +// startDate and endDate are 30 minutes apart. this means the step count value occured within those 30 minutes. +let options = { + value: 100, + startDate: (new Date(2016,6,2,6,0,0)).toISOString(), + endDate: (new Date(2016,6,2,6,30,0)).toISOString() +}; +``` + +```javascript +AppleHealthKit.saveSteps(options, (err, res) => { + if(this._handleHKError(err, 'saveSteps')){ + return; + } + // step count sample successfully saved +}); +``` + +___ + #### **`getDistanceWalkingRunning`** get the total distance walking/running on a specific day. diff --git a/examples/StepsDemo/app/components/home/index.js b/examples/StepsDemo/app/components/home/index.js index dc0a062..b9b38ca 100644 --- a/examples/StepsDemo/app/components/home/index.js +++ b/examples/StepsDemo/app/components/home/index.js @@ -108,7 +108,6 @@ class Home extends Component { if(this._handleHKError(err, 'getDailyStepCountSamples')){ return; } - console.log('res: ', res); this.setState({stepHistory: res}); }); } -- 2.26.2