public enum HealthAuthorizationStatus
- Object
- Enum<HealthAuthorizationStatus>
- HealthAuthorizationStatus
ImplementsComparable<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 constants
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. |
NOT_SUPPORTED | This platform has no health store, so the question does not apply. |
Methods
public static HealthAuthorizationStatus[] values() | |
public static HealthAuthorizationStatus valueOf(String name) |
Inherited methods
Enum constant details
NOT_DETERMINED
NOT_DETERMINEDAUTHORIZED
AUTHORIZEDDENIED
DENIEDRESTRICTED
RESTRICTEDUNKNOWN
UNKNOWNThe 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
NOT_SUPPORTEDMethod details
values
public static HealthAuthorizationStatus[] values()valueOf
public static HealthAuthorizationStatus valueOf(String name)