0.0.1 • Published 3 years ago

capacitor-plugin-health v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago
MaintainerGitHubSocial
Mick Pattersonmpat8121@MickPatterson
G. Starrg-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

ParamTypeDescription
optionsHealthQueryOptions: HealthOptions

Returns: any

Since: 0.0.1


queryAll(...)

queryAll(options: HealthQueryAllOptions) => any
ParamTypeDescription
optionsHealthQueryAllOptions: HealthOptions

Returns: any

Since: 0.0.1


store(...)

store(options: HealthStoreOptions) => any

Saves data in Health app

ParamTypeDescription
optionsHealthStoreOptions: HealthOptions

Returns: any

Since: 0.0.2


Interfaces

HealthResponse

PropTypeDescription
successbooleanResponse from plugin call
messagestringString message

HealthQueryOptions

PropTypeDescription
startDateanyStart date from which to get data
endDateanyEnd date from which to get data
dataTypeHealthDataTypeDatatype to be queried

HealthQueryResponse

PropTypeDescription
result{}(iOS/Android) single data type as result
dataany(ANDROID ONLY) - all data object returns HealthData[]'s under data.weight, data.fat_percentage & data.height

HealthData

PropTypeDescription
startDateanyStart date from which to get data
endDateanyEnd date from which to get data
valuestringValue of corresponding Datatype
unitstringUnit of corresponding value of Datatype
sourceNamestringThe source that produced this data. In iOS this is ignored and set automatically to the name of your app.
sourceBundleIdstringThe 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

PropTypeDescription
limitnumber(Optional) limit the number of values returned. Defaults to 1000

HealthStoreOptions

PropTypeDescription
startDateanyStart date from which to get data
endDateanyEnd date from which to get data
dataTypeHealthDataTypeDatatype to be queried
valuestring | numberValue of corresponding Datatype

Enums

HealthDataType

MembersValueDescription
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

NameAndroidiOSWeb
isAvailable
requestAuth
query
queryAll
store

Contributors

This project follows the all-contributors specification. Contributions of any kind welcome!

0.0.1

3 years ago