HealthConnectDiagnostics

data class HealthConnectDiagnostics(val sdkStatus: HealthConnectAvailabilityStatus, val providerPackageName: String, val providerVersionName: String?, val providerVersionCode: Long?, val deviceApiLevel: Int, val isFrameworkModule: Boolean, val grantedPermissions: Set<String>, val missingPermissions: Set<String>, val backgroundReadAvailable: Boolean, val historyReadAvailable: Boolean)

A snapshot of Health Connect diagnostic information for debugging purposes.

Obtain an instance via com.advantahealth.api.health.AFHealthTracking.getHealthConnectDiagnostics.

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

Link copied to clipboard
constructor(sdkStatus: HealthConnectAvailabilityStatus, providerPackageName: String, providerVersionName: String?, providerVersionCode: Long?, deviceApiLevel: Int, isFrameworkModule: Boolean, grantedPermissions: Set<String>, missingPermissions: Set<String>, backgroundReadAvailable: Boolean, historyReadAvailable: Boolean)

Properties

Link copied to clipboard

Whether the background-read permission has been granted.

Link copied to clipboard

The device Android API level.

Link copied to clipboard

Set of currently granted Health Connect permission strings.

Link copied to clipboard

Whether the history-read permission has been granted.

Link copied to clipboard
Link copied to clipboard

Whether Health Connect is a built-in framework module (Android 14+).

Link copied to clipboard

Set of required permission strings that have NOT been granted yet.

Link copied to clipboard

The Health Connect provider package name used for the check.

Link copied to clipboard

Installed version code of the Health Connect provider, or null if not installed.

Link copied to clipboard

Installed version name of the Health Connect provider, or null if not installed.

Link copied to clipboard

Current SDK availability status.

Functions

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