Package com.codename1.health
Cross-platform health data: reading and writing samples, aggregating them over time, watching the store for changes, and recording workouts.
Start at Health, which is never null on any
port. Backed by HealthKit on iOS and watchOS, by Health Connect on
Android, by a scriptable virtual store in the simulator, and by a local
store on the desktop and JavaScript ports.
Two platform truths this API does not hide
Read authorization is unknowable on iOS. HealthKit reports a denied
read as an empty result, deliberately, so that an app cannot infer what
a user is choosing to hide. There is therefore no hasReadPermission
anywhere in this package, and your UI must say "no data available"
rather than "you denied access".
Android never wakes your app for new data. Health Connect has no push mechanism, so subscriptions there are polled when your app runs.
Related packages
com.codename1.health.workout-- live and recorded workout sessions.com.codename1.health.sensors-- Bluetooth GATT health sensors, which work on every port with Bluetooth LE regardless of whether a health store exists.
-
ClassDescriptionWhat to compute over an aggregation bucket.Describes a bucketed summary read against
HealthStore.One bucket of anAggregateQueryresult: a span of time and the metrics computed over it.A blood-pressure reading: systolic and diastolic together, plus an optional pulse.An enumerated observation with no natural unit -- menstrual flow, for example.Entry point for the Codename One health API -- reading and writing health data, watching it for changes, recording workouts, and streaming from Bluetooth health sensors.One data type paired with one direction of access.How aHealthDataTypecombines over a time bucket.An opaque cursor marking how far through a data type's change history the app has read.The app's authorization for one data type and one direction.Whether a platform health store is usable right now, and if not, why.Receives health-store changes even after the app's process has been killed and relaunched.CreatesHealthBackgroundListenerinstances after the app's process has been killed and relaunched.A set of changes since the last time a subscription was drained.Receives health-store changes while the app is running.Thrown when the app is missing build configuration that the health APIs cannot work without -- an absentios.NSHealthShareUsageDescriptionbuild hint, a missing Health Connect privacy-policy declaration.What shape of data aHealthDataTypeproduces, and therefore whichHealthSamplesubclass a query for it returns.A kind of health data -- steps, heart rate, sleep, body mass.Describes what to delete fromHealthStore, either by identifier or by type and time range.Typed failure reasons carried byHealthException.The failure delivered through anAsyncResourcewhen a health operation does not succeed.The bucket width of anAggregateQuery-- "per hour", "per calendar day", "per calendar month".An immutable value paired with theHealthUnitit is expressed in.Whether presenting the authorization sheet would actually show the user anything.The base of every health record: what it measures and when.Where a sample came from -- which app wrote it and, when known, which device produced it.Reads, writes and watches the platform health store -- HealthKit on iOS, Health Connect on Android, a local store elsewhere.A live handle on a registered subscription.A half-open span of time,[start, end), in epoch milliseconds UTC.A unit of measure for health data.The physical dimension of aHealthUnit.The outcome of a write.A numeric measurement with a unit -- the most common kind of health sample.How a sample came to exist.One page of samples, plus the token needed to fetch the next.Describes a read againstHealthStore.A run of measurements that share one record identity -- a beat-to-beat heart-rate trace, a cadence series.A bounded activity that groups child data -- a workout, a night's sleep, a logged meal.A sleep session, optionally broken intoSleepStageIntervalspans.One stage within aSleepSample.A contiguous span of oneSleepStageinside aSleepSample.Describes a standing subscription to changes in the health store.What kind of exercise a workout records.A completed workout: what kind, how long, and the totals the platform computed for it.