Frequently Asked Questions
Which platforms does AFCore support?
Android and iOS, with the full feature set, and watchOS with a subset (no geofencing, barcode or background sync). The minimum versions are in the Android and iOS installation guides.
Can I call AFCore from any thread?
Yes. Every public call is safe from any thread or coroutine. Callbacks from subscriptions can arrive on a background thread, so switch to the main thread before you update the UI.
Do I need to manage sign-in tokens?
No. AFCore keeps the member's session alive by itself. Your app only observes the session and shows the sign-in screen when it ends:
- Android (Kotlin)
- iOS (Swift)
viewModelScope.launch {
AFCore.authentication().sessionState.collect { state ->
if (state == SessionState.SESSION_EXPIRED) navigateToLogin()
}
}
sessionSubscription = AFCore.shared.authentication().subscribeToSessionState(
onState: { state in
if state == .sessionExpired { navigateToLogin() }
},
onError: { _ in }
)
Can I use AFCore from Java or Objective-C?
Kotlin and Swift are the recommended languages. From Java, call the suspend functions through small Kotlin wrappers; from Objective-C, they appear as methods with completion handlers.
Do visit detection and step sync keep working when the app is closed?
Yes, as long as your app calls AFCore.initialize() at launch: AFCore restores them after the app is closed or the device restarts. Both belong to the member's session, so signing out stops them; start them again after the next sign-in.
What is the difference between syncSteps() and submitActivities()?
syncSteps() reads the member's steps from Health Connect or HealthKit and sends them for you; with enableAutoSync() it runs in the background on its own. submitActivities() is for apps that read health data themselves and send it in their own form.
Is member data protected on the device?
Yes. Sign-in credentials and member data are stored encrypted with the platform's secure storage, and nothing needs configuring.
How do I turn on logging?
Call enableLogging(true) and logLevel(...) on AFCoreConfig.Builder, and pass a logWriter(...) to route the SDK's messages to your own logger. Use DEBUG while you integrate and WARN or ERROR in production builds.
More answers and the complete guides are in AIDE Docs.