Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rn-apple-healthkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ym
rn-apple-healthkit
Commits
1029da31
Commit
1029da31
authored
Jun 30, 2016
by
Greg Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated readme
parent
86372b03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
README.md
README.md
+34
-0
examples/StepsDemo/app/components/home/index.js
examples/StepsDemo/app/components/home/index.js
+16
-1
No files found.
README.md
View file @
1029da31
...
...
@@ -27,6 +27,7 @@ A React Native bridge module for interacting with [Apple HealthKit] data.
*
[
getWeightSamples
](
#getweightsamples
)
*
[
saveWeight
](
#saveweight
)
*
[
getLatestHeight
](
#getlatestheight
)
*
[
getHeightSamples
](
#getheightsamples
)
*
[
saveHeight
](
#saveheight
)
*
[
getLatestBmi
](
#getlatestbmi
)
*
[
saveBmi
](
#savebmi
)
...
...
@@ -363,6 +364,39 @@ AppleHealthKit.getLatestHeight(null, (err: string, height: number) => {
__
_
#### **`getHeightSamples`**
query for height samples. the options object is used to setup a query to retrieve relevant samples.
```
javascript
let
options
=
{
unit
:
'
inch
'
,
// optional; default 'inch'
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
};
```
the callback function will be called with a
`samples`
array containing objects with
*value*
,
*startDate*
, and
*endDate*
fields
```
javascript
// samples is array of objects
[
{
value
:
74.02
,
startDate
:
'
2016-06-29T17:55:00.000-0400
'
,
endDate
:
'
2016-06-29T17:55:00.000-0400
'
},
{
value
:
74
,
startDate
:
'
2016-03-12T13:22:00.000-0400
'
,
endDate
:
'
2016-03-12T13:22:00.000-0400
'
},
...
]
```
```
javascript
AppleHealthKit
.
getHeightSamples
(
options
,
(
err
:
Object
,
samples
:
Array
<
Object
>
)
=>
{
if
(
this
.
_handleHealthKitError
(
err
,
'
getHeightSamples
'
)){
return
;
}
// use samples ...
});
```
__
_
#### **`saveHeight`**
save a numeric height value to HealthKit
...
...
examples/StepsDemo/app/components/home/index.js
View file @
1029da31
...
...
@@ -28,7 +28,8 @@ const HKOPTIONS = {
read
:
[
RPERMS
.
StepCount
,
RPERMS
.
DistanceWalkingRunning
,
RPERMS
.
FlightsClimbed
RPERMS
.
FlightsClimbed
,
RPERMS
.
Height
,
],
write
:
[
WPERMS
.
StepCount
],
}
...
...
@@ -102,6 +103,20 @@ class Home extends Component {
console
.
log
(
'
getFlightsClimbed -res->
'
,
res
);
});
let
sampleOptions
=
{
startDate
:
(
new
Date
(
2016
,
4
,
1
)).
toISOString
(),
};
AppleHealthKit
.
getHeightSamples
(
sampleOptions
,
(
err
,
samples
)
=>
{
if
(
this
.
_handleHKError
(
err
,
'
getHeightSamples
'
)){
return
;
}
console
.
log
(
'
getHeightSamples:
'
,
samples
);
});
}
_onPressItem
(
key
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment