Health Connect Diagnostics
A snapshot of Health Connect diagnostic information for debugging purposes (Android only).
Obtain an instance via AFHealthTracking.getHealthConnectDiagnostics(). The values are captured at the moment of the call and not updated afterwards; re-query to refresh. Useful for surfacing install/update prompts and for logging why a read returned no data.
Sample usage:
lifecycleScope.launch {
val diagnostics = AFHealthTracking.getHealthConnectDiagnostics()
Log.d("HealthConnect", "Status: ${diagnostics.sdkStatus}")
Log.d("HealthConnect", "Granted: ${diagnostics.grantedPermissions}")
Log.d("HealthConnect", "Background read granted: ${diagnostics.backgroundReadAvailable}")
if (diagnostics.sdkStatus == HealthConnectAvailabilityStatus.PROVIDER_UPDATE_REQUIRED) {
// Show update prompt to the user
}
}Constructors
Properties
true when the background-read permission has been granted.
The device's Android API level (Build.VERSION.SDK_INT).
Health Connect permission strings currently granted to the app.
true when the history-read (data older than 30 days) permission has been granted.
Convenience flag: true when sdkStatus is HealthConnectAvailabilityStatus.AVAILABLE, i.e. Health Connect is installed, up to date, and ready to query.
true when Health Connect ships as a built-in framework module (Android 14+) rather than a standalone app.
Required permission strings that have NOT been granted yet.
Package name of the Health Connect provider used for the check.
Installed version code of the Health Connect provider, or null if not installed.
Installed version name of the Health Connect provider, or null if not installed.
Current Health Connect SDK availability status on this device.