0.0.1 • Published 3 years ago
capacitor-plugin-health v0.0.1
Maintainer | GitHub | Social |
---|---|---|
Mick Patterson | mpat8121 | @MickPatterson |
G. Starr | g-starr |
Install
npm install capacitor-plugin-health
npm run build or ionic build
npx cap sync
npx cap add android
npx cap add ios
API
isAvailable()
isAvailable() => any
Checks if HealthKit is available
Returns: any
Since: 0.0.2
requestAuth()
requestAuth() => any
Request authorisation from the user to access Health app data
Returns: any
Since: 0.0.2
query(...)
query(options: HealthQueryOptions) => any
Retrieves data from Health app
Param | Type | Description |
---|---|---|
options | HealthQueryOptions | : HealthOptions |
Returns: any
Since: 0.0.1
queryAll(...)
queryAll(options: HealthQueryAllOptions) => any
Param | Type | Description |
---|---|---|
options | HealthQueryAllOptions | : HealthOptions |
Returns: any
Since: 0.0.1
store(...)
store(options: HealthStoreOptions) => any
Saves data in Health app
Param | Type | Description |
---|---|---|
options | HealthStoreOptions | : HealthOptions |
Returns: any
Since: 0.0.2
Interfaces
HealthResponse
Prop | Type | Description |
---|---|---|
success | boolean | Response from plugin call |
message | string | String message |
HealthQueryOptions
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 |
HealthQueryResponse
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 |
HealthData
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. |
HealthQueryAllOptions
Prop | Type | Description |
---|---|---|
limit | number | (Optional) limit the number of values returned. Defaults to 1000 |
HealthStoreOptions
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 |
Enums
HealthDataType
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' |
Supported Methods
Name | Android | iOS | Web |
---|---|---|---|
isAvailable | ✅ | ✅ | ❌ |
requestAuth | ✅ | ✅ | ❌ |
query | ✅ | ✅ | ❌ |
queryAll | ✅ | ❌ | ❌ |
store | ✅ | ✅ | ❌ |
Contributors
This project follows the all-contributors specification. Contributions of any kind welcome!
0.0.1
3 years ago