public enum HealthAuthorizationStatus

  1. Object
  2. Enum<HealthAuthorizationStatus>
  3. 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_DETERMINEDThe user has not been asked yet.
AUTHORIZEDThe app holds the access.
DENIEDThe user explicitly refused the access.
RESTRICTEDAccess 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.
UNKNOWNThe platform will not say.
NOT_SUPPORTEDThis 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_DETERMINED
The user has not been asked yet.

AUTHORIZED

AUTHORIZED
The app holds the access.

DENIED

DENIED
The user explicitly refused the access.

RESTRICTED

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

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

NOT_SUPPORTED
This platform has no health store, so the question does not apply.

Method details

values

public static HealthAuthorizationStatus[] values()

valueOf

public static HealthAuthorizationStatus valueOf(String name)