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
531e1b32
Commit
531e1b32
authored
Feb 05, 2019
by
Evgeny Evstropov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs, change one of the returning key from getSamples
parent
0b536cff
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
1 deletion
+71
-1
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+1
-1
README.md
README.md
+3
-0
docs/getSamples().md
docs/getSamples().md
+52
-0
docs/setObserverForType().md
docs/setObserverForType().md
+15
-0
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
531e1b32
...
...
@@ -156,7 +156,7 @@
}
NSDictionary
*
elem
=
@{
@"activityName"
:
[
NSNumber
numberWithInt
:[
sample
workoutActivityType
]],
@"activityName
Id
"
:
[
NSNumber
numberWithInt
:[
sample
workoutActivityType
]],
@"calories"
:
@
(
energy
),
@"tracked"
:
@
(
isTracked
),
@"sourceName"
:
[[[
sample
sourceRevision
]
source
]
name
],
...
...
README.md
View file @
531e1b32
...
...
@@ -100,8 +100,10 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
Base Methods
*
[
isAvailable
](
/docs/isAvailable(
)
.md)
*
[
initHealthKit
](
/docs/initHealthKit(
)
.md)
*
checkSharePermission
*
Realtime Methods
*
[
initStepCountObserver
](
/docs/initStepCountObserver(
)
.md)
*
[
setObserverForType
](
/docs/setObserverForType(
)
.md)
*
Read Methods
*
[
getActiveEnergyBurned
](
/docs/getActiveEnergyBurned(
)
.md)
*
[
getBasalEnergyBurned
](
/docs/getBasalEnergyBurned(
)
.md)
...
...
@@ -128,6 +130,7 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
[
getSleepSamples
](
/docs/getsleepsamples(
)
.md)
*
[
getStepCount
](
/docs/getStepCount(
)
.md)
*
[
getWeightSamples
](
/docs/getweightsamples(
)
.md)
*
[
getSamples
](
docs/getSamples(
)
.md)
*
Write Methods
*
[
saveBmi
](
/docs/savebmi(
)
.md)
*
[
saveHeight
](
/docs/saveheight(
)
.md)
...
...
docs/getSamples().md
0 → 100644
View file @
531e1b32
Query to get all activities of given type with extended information about it.
```
javascript 1.7
let options = {
startDate: (new Date(2016,4,27)).toISOString(),
endDate: (new Date()).toISOString(),
type: 'Walking', // one of: ['Walking', 'StairClimbing', 'Running', 'Cycling', 'Workout']
};
```
The callback function will be called with a
`samples`
array containing objects with
*value*
,
*startDate*
, and
*endDate*
fields
```
javascript 1.7
AppleHealthKit.getSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
return;
}
console.log(results)
});
```
Resulting object has different fields for different types.
In case of workout:
```
{
activityNameId: Number, // [NSNumber numberWithInt:[sample workoutActivityType]]
calories: Number, // [[sample totalEnergyBurned] doubleValueForUnit:[HKUnit kilocalorieUnit]]
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
sourceName: String, // [[[sample sourceRevision] source] name]
sourceId: String, // [[[sample sourceRevision] source] bundleIdentifier]
device: String, // [[sample sourceRevision] productType] or 'iPhone'
distance: Number, // [[sample totalDistance] doubleValueForUnit:[HKUnit mileUnit]]
start: String, // [RCTAppleHealthKit buildISO8601StringFromDate:sample.startDate];
end: String, // [RCTAppleHealthKit buildISO8601StringFromDate:sample.endDate];
}
```
for other types:
```
{
activityNameId: Number, // [NSNumber numberWithInt:[sample workoutActivityType]]
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
sourceName: String, // [[[sample sourceRevision] source] name]
sourceId: String, // [[[sample sourceRevision] source] bundleIdentifier]
device: String, // [[sample sourceRevision] productType] or 'iPhone'
start: String, // [RCTAppleHealthKit buildISO8601StringFromDate:sample.startDate];
end: String, // [RCTAppleHealthKit buildISO8601StringFromDate:sample.endDate];
//based on required type, one of the following will be present.
distance: Number, // [[sample totalDistance] doubleValueForUnit:[HKUnit mileUnit]]
calories: Number, // [[sample totalEnergyBurned] doubleValueForUnit:[HKUnit kilocalorieUnit]]
}
```
docs/setObserverForType().md
0 → 100644
View file @
531e1b32
Will listen for any updates in a given type data in healthKit and call app.
type - one of the
`['Walking', 'StairClimbing', 'Running', 'Cycling', 'Workout']`
```
javascript 1.8
import { NativeAppEventEmitter } from 'react-native';
//...//
AppleHealthKit.setObserver({ type: 'Walking' });
NativeAppEventEmitter.addListener(
'observer',
callback
);
```
So, callback would be call when new data of given type appears. When it happens, in order to get new info
need to call getSamples() function with proper arguments.
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