register User
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:
Android: connectGoogleHealthConnect
Return
true if registration succeeded; false otherwise.
Parameters
device Id
The unique identifier of the health device.
device Type
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")
}Content copied to clipboard
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)")
}
}Content copied to clipboard