Enum HealthAuthorizationStatus
- All Implemented Interfaces:
Comparable<HealthAuthorizationStatus>
The app's authorization for one data type and one direction.
The asymmetry you must handle
Write authorization is truthfully reportable on both platforms. Read
authorization is not. HealthKit deliberately refuses to disclose it,
because telling an app "the user denied you access to pregnancy data"
leaks the very thing the user was hiding. So
HealthStore.getReadAuthorizationStatus(HealthDataType) returns
UNKNOWN on iOS regardless of what the user actually chose, and any
code that branches on it must handle that value.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe app holds the access.The user explicitly refused the access.The user has not been asked yet.This platform has no health store, so the question does not apply.Access is blocked by something outside the user's control at this moment -- a device management policy, or a data type the platform does not permit this app to touch.The platform will not say. -
Method Summary
Modifier and TypeMethodDescriptionstatic HealthAuthorizationStatusReturns the enum constant of this type with the specified name.static HealthAuthorizationStatus[]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_DETERMINED
The user has not been asked yet. -
AUTHORIZED
The app holds the access. -
DENIED
The user explicitly refused the access. -
RESTRICTED
Access is blocked by something outside the user's control at this moment -- a device management policy, or a data type the platform does not permit this app to touch. -
UNKNOWN
The platform will not say. Returned for read access on iOS in every case, by design; it means neither "granted" nor "denied" and must not be rendered to the user as either.
The only honest way to find out whether reads work is to run a query -- see
HealthStore.hasAnyData(HealthDataType,HealthTimeRange). -
NOT_SUPPORTED
This platform has no health store, so the question does not apply.
-
-
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
-