diff --git a/README.md b/README.md index 3965f991bcfeb09164477ebe3eb505af3c25bb8f..9ffcd171ff6f0bcf660be7c1ceeeefebb6b597f2 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 dc0a0623c634c1c6c14d16dcc4b7e116a212be84..b9b38cacf20ffab827acdf487876bf21341074ee 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}); }); }