Uses Capacitor 3.0
Capacitor 3.0 plugin for Android and iOS that allows data to be sent and retrieved from Google Fit or Apple Health
Maintainer | GitHub | Social |
---|---|---|
Mick Patterson | mpat8121 | @Mick_Patterson_ |
G. Starr | g-starr |
npm install capacitor-plugin-health
npm run build or ionic build
npx cap sync
npx cap add android
npx cap add ios
isAvailable() => any
Checks if HealthKit is available
Returns: any
Since: 0.0.2
requestAuth() => any
Request authorisation from the user to access Health app data
Returns: any
Since: 0.0.2
query(options: HealthQueryOptions) => any
Retrieves data from Health app
Param | Type | Description |
---|---|---|
options |
HealthQueryOptions |
: HealthOptions |
Returns: any
Since: 0.0.1
queryAll(options: HealthQueryAllOptions) => any
Param | Type | Description |
---|---|---|
options |
HealthQueryAllOptions |
: HealthOptions |
Returns: any
Since: 0.0.1
store(options: HealthStoreOptions) => any
Saves data in Health app
Param | Type | Description |
---|---|---|
options |
HealthStoreOptions |
: HealthOptions |
Returns: any
Since: 0.0.2
Prop | Type | Description |
---|---|---|
success |
boolean |
Response from plugin call |
message |
string |
String message |
Prop | Type | Description |
---|---|---|
startDate |
any |
Start date from which to get data |
endDate |
any |
End date from which to get data |
dataType |
HealthDataType |
Datatype to be queried |
Prop | Type | Description |
---|---|---|
result |
{} |
(iOS/Android) single data type as result |
data |
any |
(ANDROID ONLY) - all data object returns HealthData[]'s under data.weight, data.fat_percentage & data.height |
Prop | Type | Description |
---|---|---|
startDate |
any |
Start date from which to get data |
endDate |
any |
End date from which to get data |
value |
string |
Value of corresponding Datatype |
unit |
string |
Unit of corresponding value of Datatype |
sourceName |
string |
The source that produced this data. In iOS this is ignored and set automatically to the name of your app. |
sourceBundleId |
string |
The complete package of the source that produced this data. In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and set automatically to the bunde id of the app. |
Prop | Type | Description |
---|---|---|
limit |
number |
(Optional) limit the number of values returned. Defaults to 1000 |
Prop | Type | Description |
---|---|---|
startDate |
any |
Start date from which to get data |
endDate |
any |
End date from which to get data |
dataType |
HealthDataType |
Datatype to be queried |
value |
string | number |
Value of corresponding Datatype |
Members | Value | Description |
---|---|---|
HEIGHT |
'height' |
IOS/ANDROID - 'height' |
WEIGHT |
'weight' |
IOS/ANDROID - 'weight' |
FAT_PERCENTAGE |
'fat_percentage' |
IOS/ANDROID - 'fat_percentage' |
BMI |
'bmi' |
IOS ONLY - 'bmi' |
WAIST |
'waist' |
IOS ONLY - 'waist' |
Name | Android | iOS | Web |
---|---|---|---|
isAvailable | ✅ | ✅ | ❌ |
requestAuth | ✅ | ✅ | ❌ |
query | ✅ | ✅ | ❌ |
queryAll | ✅ | ❌ | ❌ |
store | ✅ | ✅ | ❌ |
Mick Patterson 💻 |
Graham Starr 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!