public enum HealthError

  1. Object
  2. Enum<HealthError>
  3. HealthError

ImplementsComparable<HealthError>

Typed failure reasons carried by HealthException. Ports map their platform error codes onto these so cross-platform code can branch on a stable value instead of parsing messages.

Enum constants

NOT_SUPPORTEDThe port, device or OS version has no health support at all, or the requested capability is unavailable on this platform.
TYPE_NOT_SUPPORTEDThe requested data type is not available on this platform, even though health support in general is.
PROVIDER_UNAVAILABLEThe Health Connect provider app is not installed.
PROVIDER_UPDATE_REQUIREDThe installed Health Connect provider is too old.
UNAUTHORIZEDThe operation was refused for lack of authorization.
USER_CANCELEDThe user dismissed a platform authorization or setup flow.
INVALID_ARGUMENTA query or write was rejected before reaching the platform because the request itself was malformed – an inverted time range, an instantaneous write of a cumulative type, a negative limit.
UNIT_MISMATCHA unit was supplied that measures a different dimension than the data type requires.
INVALID_DATAA payload could not be decoded – a truncated or malformed GATT characteristic value, or a platform record the port could not map.
DATABASE_INACCESSIBLEThe platform’s health database could not be opened.
ANCHOR_EXPIREDA stored anchor or change token was rejected by the platform, usually because it aged out.
QUOTA_EXCEEDEDThe operation would return or write more data than the platform permits in one call.
RATE_LIMITEDThe platform rate-limited the request.
SESSION_STATEA workout session method was called in a state that does not allow it – pausing a session that never started, ending one twice.
SENSOR_DISCONNECTEDA live BLE sensor dropped its connection mid-session.
TIMEOUTThe operation did not complete within its safety timeout.
UNKNOWNAnything the port could not classify.

Methods

public static HealthError[] values()
public static HealthError valueOf(String name)

Inherited methods

Enum constant details

NOT_SUPPORTED

NOT_SUPPORTED
The port, device or OS version has no health support at all, or the requested capability is unavailable on this platform. Returned by every operation on the fallback Health base class.

TYPE_NOT_SUPPORTED

TYPE_NOT_SUPPORTED
The requested data type is not available on this platform, even though health support in general is.

PROVIDER_UNAVAILABLE

PROVIDER_UNAVAILABLE
The Health Connect provider app is not installed. Recoverable by sending the user to Health.openProviderSetup().

PROVIDER_UPDATE_REQUIRED

PROVIDER_UPDATE_REQUIRED
The installed Health Connect provider is too old. Also recoverable via Health.openProviderSetup().

UNAUTHORIZED

UNAUTHORIZED

The operation was refused for lack of authorization.

Note that a read denial does not reliably produce this error: HealthKit reports a denied read as an empty result, by design. See HealthStore.getReadAuthorizationStatus(HealthDataType).

USER_CANCELED

USER_CANCELED
The user dismissed a platform authorization or setup flow. Only reported where the platform distinguishes cancellation from denial.

INVALID_ARGUMENT

INVALID_ARGUMENT
A query or write was rejected before reaching the platform because the request itself was malformed – an inverted time range, an instantaneous write of a cumulative type, a negative limit.

UNIT_MISMATCH

UNIT_MISMATCH
A unit was supplied that measures a different dimension than the data type requires.

INVALID_DATA

INVALID_DATA
A payload could not be decoded – a truncated or malformed GATT characteristic value, or a platform record the port could not map. Never surfaces as an unchecked exception from a parser.

DATABASE_INACCESSIBLE

DATABASE_INACCESSIBLE
The platform’s health database could not be opened. On iOS this is HKErrorDatabaseInaccessible, raised while the device is locked – which is exactly when a background observer fires. Retryable: callers should try again once the device is unlocked rather than treating it as “no data”.

ANCHOR_EXPIRED

ANCHOR_EXPIRED
A stored anchor or change token was rejected by the platform, usually because it aged out. The caller must resynchronize with a full time-range read; see HealthChangeBatch.isResyncRequired().

QUOTA_EXCEEDED

QUOTA_EXCEEDED
The operation would return or write more data than the platform permits in one call. Use paging or a smaller batch.

RATE_LIMITED

RATE_LIMITED
The platform rate-limited the request.

SESSION_STATE

SESSION_STATE
A workout session method was called in a state that does not allow it – pausing a session that never started, ending one twice.

SENSOR_DISCONNECTED

SENSOR_DISCONNECTED
A live BLE sensor dropped its connection mid-session.

TIMEOUT

TIMEOUT
The operation did not complete within its safety timeout.

UNKNOWN

UNKNOWN
Anything the port could not classify. The message carries the platform’s own text.

Method details

values

public static HealthError[] values()

valueOf

public static HealthError valueOf(String name)