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.

  • 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.

Types

enum AggregateMetricWhat to compute over an aggregation bucket.
class AggregateQueryDescribes a bucketed summary read against HealthStore.
class AggregateResultOne bucket of an AggregateQuery result: a span of time and the metrics computed over it.
class BloodPressureSampleA blood-pressure reading: systolic and diastolic together, plus an optional pulse.
class CategorySampleAn enumerated observation with no natural unit – menstrual flow, for example.
class HealthEntry point for the Codename One health API – reading and writing health data, watching it for changes, recording workouts, and streaming from Bluetooth health sensors.
class HealthAccessOne data type paired with one direction of access.
enum HealthAggregationStyleHow a HealthDataType combines over a time bucket.
class HealthAnchorAn opaque cursor marking how far through a data type’s change history the app has read.
enum HealthAuthorizationStatusThe app’s authorization for one data type and one direction.
enum HealthAvailabilityWhether a platform health store is usable right now, and if not, why.
interface HealthBackgroundListenerReceives health-store changes even after the app’s process has been killed and relaunched.
interface HealthBackgroundListenerFactoryCreates HealthBackgroundListener instances after the app’s process has been killed and relaunched.
class HealthChangeBatchA set of changes since the last time a subscription was drained.
interface HealthChangeListenerReceives health-store changes while the app is running.
class HealthConfigurationExceptionThrown when the app is missing build configuration that the health APIs cannot work without – an absent ios.NSHealthShareUsageDescription build hint, a missing Health Connect privacy-policy declaration.
enum HealthDataKindWhat shape of data a HealthDataType produces, and therefore which HealthSample subclass a query for it returns.
class HealthDataTypeA kind of health data – steps, heart rate, sleep, body mass.
class HealthDeleteRequestDescribes what to delete from HealthStore, either by identifier or by type and time range.
enum HealthErrorTyped failure reasons carried by HealthException.
class HealthExceptionThe failure delivered through an AsyncResource when a health operation does not succeed.
class HealthIntervalThe bucket width of an AggregateQuery – “per hour”, “per calendar day”, “per calendar month”.
class HealthQuantityAn immutable value paired with the HealthUnit it is expressed in.
enum HealthRequestStatusWhether presenting the authorization sheet would actually show the user anything.
class HealthSampleThe base of every health record: what it measures and when.
class HealthSourceWhere a sample came from – which app wrote it and, when known, which device produced it.
class HealthStoreReads, writes and watches the platform health store – HealthKit on iOS, Health Connect on Android, a local store elsewhere.
class HealthSubscriptionA live handle on a registered subscription.
class HealthTimeRangeA half-open span of time, [start, end), in epoch milliseconds UTC.
class HealthUnitA unit of measure for health data.
enum HealthUnitDimensionThe physical dimension of a HealthUnit.
class HealthWriteResultThe outcome of a write.
class QuantitySampleA numeric measurement with a unit – the most common kind of health sample.
enum RecordingMethodHow a sample came to exist.
class SamplePageOne page of samples, plus the token needed to fetch the next.
class SampleQueryDescribes a read against HealthStore.
class SeriesSampleA run of measurements that share one record identity – a beat-to-beat heart-rate trace, a cadence series.
class SessionSampleA bounded activity that groups child data – a workout, a night’s sleep, a logged meal.
class SleepSampleA sleep session, optionally broken into SleepStageInterval spans.
enum SleepStageOne stage within a SleepSample.
class SleepStageIntervalA contiguous span of one SleepStage inside a SleepSample.
enum SleepStageSupportHow much stage detail a SleepSample actually carries.
class SubscriptionRequestDescribes a standing subscription to changes in the health store.
enum WorkoutActivityTypeWhat kind of exercise a workout records.
class WorkoutSampleA completed workout: what kind, how long, and the totals the platform computed for it.