Docs · AppsKitSDK (AKS) — Android Integration Guide
8. Local preferences (PreferencesManager)
AKS also exposes the simple key-value store it uses internally (backed by multiplatform-settings, i.e. SharedPreferences under the hood on Android), so you can use it for your own app's lightweight preferences instead of pulling in another storage dependency:
kotlin
// Strings, Ints, Booleans, Longs, Floats
PreferencesManager.addInPreferences("user_name", "Talha")
PreferencesManager.addInPreferences("launch_count", 5)
PreferencesManager.addInPreferences("onboarding_done", true)
PreferencesManager.addInPreferencesAsLong("last_sync_time", System.currentTimeMillis())
PreferencesManager.addInPreferencesAsFloat("scroll_position", 12.5f)
PreferencesManager.getStringPreferences("user_name", "")
PreferencesManager.getIntegerPreferences("launch_count", 0)
PreferencesManager.getBooleanPreferences("onboarding_done", false)
PreferencesManager.getLongPreferences("last_sync_time", 0L)
PreferencesManager.getFloatPreferences("scroll_position", 0f)
// Remove a single key
PreferencesManager.flushSavedCache("user_name")
// Store/retrieve a serializable object as JSON
PreferencesManager.addInPreferences("user_profile", profile, UserProfile.serializer())
PreferencesManager.getCustomPreference("user_profile", UserProfile.serializer())This is the same store AKS uses for its own internal flags (like REMOVE_ADS), so keys you choose should be namespaced/distinct from the ones documented elsewhere in this guide to avoid collisions.