registerUser

abstract suspend fun registerUser(deviceId: String, deviceType: DeviceType): SmartWalkingProfile

Registers the member with SmartWalking for another device or re-registers a new device.

Use this when the user has changed devices or you need to attach an additional device. For first-time setup and permission prompts, prefer the platform flows:

Return

true if registration succeeded; false otherwise.

Parameters

deviceId

The unique identifier of the health device.

deviceType

The type ("HEALTHCONNECT", "IOS", "FITBIT").

Throws

if registration fails.

Android (Kotlin)

lifecycleScope.launch {
val ok = AFCore.smartWalking().registerUser(deviceId = "new-device-123", deviceType = "HEALTHCONNECT")
if (ok) showMessage("Device registered") else showError("Registration failed")
}

iOS (Swift)

Task {
do {
let ok = try await AFCore.shared.smartWalking().registerUser(deviceId: "new-device-123", deviceType: "IOS")
ok ? self.showMessage("Device registered") : self.showError("Registration failed")
} catch {
self.showError("Registration failed: \\(error.localizedDescription)")
}
}