SmartWalking
SmartWalking turns the member's daily steps into program credit. It connects the device's health platform, Apple HealthKit on iOS or Google Health Connect on Android, and sends steps, distance, calories and active minutes to ActiveFit+. Each day the member reaches their step goal counts as a qualifying activity.
What you can do
- Connect the member's health platform in one call: it shows the system permission sheet, registers the device and turns on background sync.
- Let the SDK sync steps in the background, across app restarts and reboots, or sync on demand from a button.
- Show a sync indicator from the SDK's sync events.
- Build a step dashboard: today's steps against the daily goal, plus distance, calories, active minutes and week or month charts from the member's activity history.
- Disconnect the member when they no longer want to share steps.
Key APIs
| Call | What it is for |
|---|---|
smartWalking().getRegisteredProfile() | Whether the member is already connected |
smartWalking().connectGoogleHealthConnect(context, deviceId) / connectAppleHealthKit(deviceId) | Connect the health platform |
smartWalking().syncSteps() | Sync now |
smartWalking().subscribeToEvents() | Sync started, finished or failed |
smartWalking().getDailyStepGoal() | The member's daily step goal |
activities().get(month, year) | Step totals per day for the dashboard |
smartWalking().unregisterUser() | Disconnect |
Example
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
val profile = AFCore.smartWalking().getRegisteredProfile()
if (profile?.isConnected != true) {
// Health Connect permission sheet, device registration and background sync in one call
AFCore.smartWalking().connectGoogleHealthConnect(context = activity, deviceId = installId)
}
val goal = AFCore.smartWalking().getDailyStepGoal()
val result = AFCore.smartWalking().syncSteps() // optional: background sync runs on its own
showDashboard(goal, synced = result.status)
}
Task {
let profile = try await AFCore.shared.smartWalking().getRegisteredProfile()
if profile?.isConnected != true {
// HealthKit permission sheet, device registration and background sync in one call
_ = try await AFCore.shared.smartWalking().connectAppleHealthKit(deviceId: installId)
}
let goal = try await AFCore.shared.smartWalking().getDailyStepGoal()
let result = try await AFCore.shared.smartWalking().syncSteps() // optional: background sync runs on its own
showDashboard(goal: goal, synced: result.status)
}
UI Reference
Show a connect screen while the member is not linked, then the step dashboard once they are.
Once connected, a progress ring shows today's steps against the goal, with distance, calories, active minutes and a sync button.
Learn more
- API Reference for
smartWalking()and its events. - Complete integration guides, including platform setup and background sync, are in AIDE Docs.