HealthKitDiagnostics

data class HealthKitDiagnostics(val isHealthDataAvailable: Boolean, val authorizationRequestStatus: HealthKitAuthRequestStatus, val stepTrackingStatus: HealthPermissionStatus, val osVersion: String, val deviceModel: String, val requestedReadTypes: Set<String>, val stepDataSources: List<HealthKitDataSource> = emptyList())

A snapshot of Apple HealthKit diagnostic information for debugging purposes.

Obtain an instance via AFHealthTracking.getHealthKitDiagnostics() (iOS / watchOS).

Important Apple privacy note: HealthKit does not expose whether the user granted or denied individual read permissions. authorizationRequestStatus only tells you whether the permission dialog has been shown — not the user's actual choices. If the user denied a specific type, your app simply receives no data for that type.

Sample usage (Swift interop / Kotlin):

val diag = AFHealthTracking.getHealthKitDiagnostics()
println(diag)

if (!diag.isHealthDataAvailable) {
// HealthKit is not supported on this device (e.g., iPad)
}
if (diag.authorizationRequestStatus == HealthKitAuthRequestStatus.SHOULD_REQUEST) {
AFHealthTracking.requestPermissions(null)
}

Constructors

Link copied to clipboard
constructor(isHealthDataAvailable: Boolean, authorizationRequestStatus: HealthKitAuthRequestStatus, stepTrackingStatus: HealthPermissionStatus, osVersion: String, deviceModel: String, requestedReadTypes: Set<String>, stepDataSources: List<HealthKitDataSource> = emptyList())

Properties

Link copied to clipboard

Whether the authorization dialog has already been presented. Per Apple's privacy model this reflects only whether the prompt was shown, not the user's per-type read choices.

Link copied to clipboard

Device model string (e.g. "iPhone", "Apple Watch").

Link copied to clipboard

true when HealthKit is supported on this device (HKHealthStore.isHealthDataAvailable()); false on hardware without HealthKit, e.g. iPad.

Link copied to clipboard

Operating-system version string (e.g. "17.4.1").

Link copied to clipboard

Human-readable names of the HealthKit data types the SDK requested read access to.

Link copied to clipboard

Apps and devices that have contributed step-count data to HealthKit; empty when none are found or the probe could not run.

Link copied to clipboard

Inferred step-tracking read-permission status, derived from a data-query probe rather than a direct API (HealthKit does not expose read grants).

Functions

Link copied to clipboard
open override fun toString(): String