connectGoogleHealthConnect

abstract suspend fun connectGoogleHealthConnect(context: Any, deviceId: String): SmartWalkingProfile

Android primary flow — connects Google Health Connect and performs registration + permissions.

Platform: Android only.

Return

true if the connection was successful; false otherwise.

Parameters

context

Application or Activity context (required to launch Health Connect UI).

deviceId

Health Connect device identifier to associate.

Throws

if the connection fails or the user denies permissions.

Kotlin

lifecycleScope.launch {
try {
val ok = AFCore.smartWalking().connectGoogleHealthConnect(
context = this@MainActivity,
deviceId = "DEVICE_ID"
)
if (ok) showMessage("Health Connect connected")
else showError("Connection failed")
} catch (t: Throwable) {
showError("Health Connect error: ${t.message}")
}
}