enable Auto Sync
Enables automatic background step synchronization.
How it works per platform:
iOS / watchOS: Registers a HealthKit background delivery observer for step count data. When iOS wakes the app with new step data (approximately hourly), the observer callback triggers syncSteps via com.advantahealth.internal.util.AFCoreScope.
Android: Schedules a periodic WorkManager task that reads Health Connect data and calls syncSteps. Runs approximately every hour when network is available and battery is not critically low.
Idempotency: If auto-sync is already enabled, this is a no-op.
The enabled state is persisted in preferences (smartWalkingAutoSyncEnabled). On next app launch, com.advantahealth.api.AFCore.initialize checks this flag and automatically re-enables auto-sync if the member still has the SmartWalking entitlement.
Kotlin
AFCore.smartWalking().enableAutoSync()
Log.i("SmartWalking", "Background sync enabled")Swift
try await AFCore.shared.smartWalking().enableAutoSync()Throws
if registering the background delivery observer fails.