register User
Registers (or re-registers) the member with SmartWalking for a specific device.
Use this for device changes or re-registration scenarios. For first-time setup, prefer the platform-specific connect methods (connectAppleHealthKit on iOS, connectGoogleHealthConnect on Android) which handle permissions automatically.
Idempotency: If the member is already registered with the same deviceId and deviceType, this skips the API call and returns the cached profile.
Kotlin
lifecycleScope.launch {
try {
val profile = AFCore.smartWalking().registerUser(
deviceId = "health-connect-device-id",
deviceType = DeviceType.HEALTH_CONNECT
)
if (profile.isConnected) showMessage("Registered")
} catch (e: Exception) {
showError("Registration failed: ${e.message}")
}
}Swift
Task {
do {
let profile = try await AFCore.shared.smartWalking().registerUser(
deviceId: "healthkit-device-id",
deviceType: .ios
)
if profile.isConnected { showMessage("Registered") }
} catch {
showError("Registration failed: \(error.localizedDescription)")
}
}Return
A SmartWalkingProfile reflecting the server’s registration state.
Parameters
A unique identifier for the health device (e.g. Health Connect device ID, or a UUID generated by the consumer app for HealthKit).
The health platform type. Use DeviceType.IOS for HealthKit, DeviceType.HEALTH_CONNECT for Google Health Connect.
Throws
if deviceId is blank.
if no member ID is available (not logged in) or the member ID is not a valid integer.
on network or server errors.