Android SDK
Android SDK - Remote Config
Read remote config values with the FunnelMob Android SDK.
Remote Config lets you change values in your app without shipping a new build. Define keys in the FunnelMob dashboard (under Feature Management → Remote Config), and read them from the SDK at runtime to flip features on or off, tune values, or roll out experiments.
The SDK fetches config automatically during initialize(), caches the result for 5 minutes in SharedPreferences, and exposes synchronous getters that work even before the network call completes (using cached or default values).
Reading values
// Untyped — returns Any?
val raw = FunnelMob.getConfig("welcome_message")
// Typed with a default — returns the default if the key is missing or the type doesn't match
val message: String = FunnelMob.getConfig("welcome_message", "Welcome!")
val maxRetries: Int = FunnelMob.getConfig("max_retry_attempts", 3)
val darkMode: Boolean = FunnelMob.getConfig("dark_mode_default", false)
// Get everything at once
val all: Map<String, Any?> = FunnelMob.getAllConfig()The typed overload is the recommended way to read values — it gives you compile-time type safety and a guaranteed fallback if the key isn't set or the dashboard value is the wrong type.
Reacting when config loads
If you need to react the first time config arrives (for example, to render a paywall whose copy is configured remotely), register a callback:
FunnelMob.onConfigLoaded { config ->
// config: Map<String, Any?> — full snapshot
val theme = FunnelMob.getConfig("theme", "light")
applyTheme(theme)
}The callback fires immediately if config is already loaded (e.g. from cache), so you don't need to special-case the "already loaded" path.
Caching behavior
| Layer | Where | TTL |
|---|---|---|
| In-memory | Singleton state | Process lifetime |
| Disk | SharedPreferences (funnelmob_config) | 5 minutes |
| Server | Redis (transparent to SDK) | Invalidated on dashboard edits |
On launch the SDK loads the cached snapshot synchronously, then fetches the latest in the background. Dashboard edits invalidate the server-side cache instantly, but devices may take up to 5 minutes to pick up changes because of the local cache.
Supported value types
Set values in the dashboard as one of: string, number, boolean, or json. The SDK preserves these types — read them back as String, Int/Long/Double, Boolean, or Map<String, Any?> / List<Any?> respectively.
// JSON values come back as Map<String, Any?>
@Suppress("UNCHECKED_CAST")
val flags = FunnelMob.getConfig("feature_flags") as? Map<String, Any?>
val aiEnabled = flags?.get("ai_insights") as? Boolean ?: falseCommon patterns
Feature flags
if (FunnelMob.getConfig("new_checkout_enabled", false)) {
showNewCheckout()
} else {
showLegacyCheckout()
}Tuning values without a release
val timeoutMs: Long = FunnelMob.getConfig("api_timeout_ms", 30_000L)
okHttpClient.newBuilder()
.connectTimeout(timeoutMs, TimeUnit.MILLISECONDS)
.build()Server-driven copy
welcomeView.text = FunnelMob.getConfig("welcome_message", "Welcome!")