Enum HealthError
- All Implemented Interfaces:
Comparable<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 Constant Summary
Enum ConstantsEnum ConstantDescriptionA stored anchor or change token was rejected by the platform, usually because it aged out.The platform's health database could not be opened.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.A payload could not be decoded -- a truncated or malformed GATT characteristic value, or a platform record the port could not map.The port, device or OS version has no health support at all, or the requested capability is unavailable on this platform.The Health Connect provider app is not installed.The installed Health Connect provider is too old.The operation would return or write more data than the platform permits in one call.The platform rate-limited the request.A live BLE sensor dropped its connection mid-session.A workout session method was called in a state that does not allow it -- pausing a session that never started, ending one twice.The operation did not complete within its safety timeout.The requested data type is not available on this platform, even though health support in general is.The operation was refused for lack of authorization.A unit was supplied that measures a different dimension than the data type requires.Anything the port could not classify.The user dismissed a platform authorization or setup flow. -
Method Summary
Modifier and TypeMethodDescriptionstatic HealthErrorReturns the enum constant of this type with the specified name.static HealthError[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
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 fallbackHealthbase class. -
TYPE_NOT_SUPPORTED
The requested data type is not available on this platform, even though health support in general is. -
PROVIDER_UNAVAILABLE
The Health Connect provider app is not installed. Recoverable by sending the user toHealth.openProviderSetup(). -
PROVIDER_UPDATE_REQUIRED
The installed Health Connect provider is too old. Also recoverable viaHealth.openProviderSetup(). -
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
The user dismissed a platform authorization or setup flow. Only reported where the platform distinguishes cancellation from denial. -
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
A unit was supplied that measures a different dimension than the data type requires. -
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
The platform's health database could not be opened. On iOS this isHKErrorDatabaseInaccessible, 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
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; seeHealthChangeBatch.isResyncRequired(). -
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
The platform rate-limited the request. -
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
A live BLE sensor dropped its connection mid-session. -
TIMEOUT
The operation did not complete within its safety timeout. -
UNKNOWN
Anything the port could not classify. The message carries the platform's own text.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-