Remote Config
OneManage.configManager provides remote feature flags and configuration values backed by a local SQLDelight cache. Change your app's behaviour on-the-fly without shipping a new build.
Reading Values
Use typed accessors to read config values. Each accessor takes a key and an optional default fallback used when the key doesn't exist or the network is unavailable.
// String (default: "")
val welcomeText = OneManage.configManager.getString("welcome_message", "Welcome!")
// Boolean (default: false)
val isDarkModeEnabled = OneManage.configManager.getBoolean("dark_mode_enabled")
// Int (default: 0)
val maxRetries = OneManage.configManager.getInt("max_retry_count", 3)
// Double (default: 0.0)
val discountRate = OneManage.configManager.getDouble("discount_rate", 0.1)
// Long (default: 0L)
val sessionTimeout = OneManage.configManager.getLong("session_timeout_ms", 300_000L)
Observing Config Changes (Reactive)
configs is a StateFlow<Map<String, String>> — collect it in a ViewModel or Composable to automatically react to live config pushes from the dashboard:
// In a shared ViewModel
val featureEnabled: StateFlow<Boolean> = OneManage.configManager.configs
.map { it["new_checkout_flow"]?.toBooleanStrictOrNull() ?: false }
.stateIn(viewModelScope, SharingStarted.Eagerly, false)
// In Compose
val configs by OneManage.configManager.configs.collectAsState()
val isEnabled = configs["new_feature"]?.toBooleanStrictOrNull() ?: false
Manual Refresh
The SDK syncs config automatically at initialization. To force a re-fetch at runtime (e.g. on app foreground):
// Fire-and-forget background fetch
OneManage.configManager.fetchRemoteConfig()
Caching Behaviour
| Scenario | Behaviour |
|---|---|
| App start (online) | Fetches from server, updates local DB cache |
| App start (offline) | Loads from local DB cache — stale config is better than none |
| Fetch fails at runtime | Existing in-memory cache is left untouched |
| New install, no network | All accessors return their default parameter |
API Reference
| Method | Return | Description |
|---|---|---|
getString(key, default) |
String |
Read a string config value |
getBoolean(key, default) |
Boolean |
Read a boolean config value |
getInt(key, default) |
Int |
Read an integer config value |
getDouble(key, default) |
Double |
Read a double config value |
getLong(key, default) |
Long |
Read a long config value |
fetchRemoteConfig() |
Unit |
Trigger a background re-fetch from the server |
configs |
StateFlow<Map<String, String>> |
Reactive map of all config values |