The image you linked is specific to whether or not the user has Health Connect installed. This is a function provided by the Health Connect API. To determine this, you can use getSdkStatus:
val availabilityStatus = HealthConnectClient.getSdkStatus(context, providerPackageName)
if (availabilityStatus == HealthConnectClient.SDK_UNAVAILABLE) {
return // early return as there is no viable integration
}
if (availabilityStatus == HealthConnectClient.SDK_UNAVAILABLE_PROVIDER_UPDATE_REQUIRED) {
// Optionally redirect to package installer to find a provider, for example:
val uriString = "market://details?id=$providerPackageName&url=healthconnect%3A%2F%2Fonboarding"
context.startActivity(
Intent(Intent.ACTION_VIEW).apply {
setPackage("com.android.vending")
data = Uri.parse(uriString)
putExtra("overlay", true)
putExtra("callerId", context.packageName)
}
)
return
}
val healthConnectClient = HealthConnectClient.getOrCreate(context)
// Issue operations with healthConnectClient
This will tell you if the user has Health Connect installed.
If you specifically want to understand if the user has Google Fit synced with Health Connect, you should be able to check the DataOrigin in your ReadRecordsRequest to determine the package that wrote the data. This will only work after Google Fit has written something to the Health Connect store.
It's important to note that there are many apps compatible with Health Connect that write steps, not just Google Fit. It might make more sense to read an aggregate step count from Health Connect.