unregisterUser

abstract suspend fun unregisterUser(): Boolean

Disconnects the member from SmartWalking.

Performs the following in order:

  1. Disables auto-sync (disableAutoSync) — tears down HealthKit observers or cancels WorkManager jobs.

  2. Calls the server to mark the member as "not configured".

  3. Clears all local SmartWalking preferences (connection state, device type, registration timestamp, last sync timestamp).

Always returns true — even if the server call fails, local state is cleared to prevent a stale "connected" indicator. The server will eventually detect the disconnection on the next sync attempt.

Kotlin

lifecycleScope.launch {
AFCore.smartWalking().unregisterUser()
showMessage("SmartWalking disconnected")
navigateToSetup()
}

Swift

Task {
let _ = try await AFCore.shared.smartWalking().unregisterUser()
showMessage("SmartWalking disconnected")
navigateToSetup()
}

Return

true always — disconnection is best-effort on the server side.