The remote config module delivers key-value pairs from the AppDNA Console to your app. All reads are synchronous from an in-memory cache — they never block the JS thread or require a network call.
Get Config Values
Read values using typed getters with default fallbacks:
const welcome = AppDNA.remoteConfig.getString("welcome_message", "Hello!");
const maxRetries = AppDNA.remoteConfig.getInt("max_retries", 3);
const discount = AppDNA.remoteConfig.getDouble("discount_rate", 0.1);
const promoEnabled = AppDNA.remoteConfig.getBool("show_promo", false);
For complex values, use getJSON:
const bannerConfig = AppDNA.remoteConfig.getJSON("hero_banner");
// Returns Record<string, any> | null
Module Access
const remoteConfig = AppDNA.remoteConfig;
Module Methods
| Method | Signature | Description |
|---|
getString | getString(key: string, defaultValue: string): string | Get a string value |
getInt | getInt(key: string, defaultValue: number): number | Get an integer value |
getDouble | getDouble(key: string, defaultValue: number): number | Get a double value |
getBool | getBool(key: string, defaultValue: boolean): boolean | Get a boolean value |
getJSON | getJSON(key: string): Record<string, any> | null | Get a JSON object |
getAllKeys | getAllKeys(): string[] | List all available config keys |
When Config Refreshes
The SDK refreshes remote config automatically:
- On app launch — if the cached config has expired (default TTL: 5 minutes)
- On return from background — same TTL check
If the fetch fails, the SDK continues using cached values.
The config TTL is configurable via the options parameter: AppDNA.configure("key", "production", { configTTL: 600 }) (in seconds).
Listen for Config Changes
const unsubscribe = AppDNA.remoteConfig.onConfigUpdated((updatedKeys: string[]) => {
if (updatedKeys.includes("show_promo")) {
const show = AppDNA.remoteConfig.getBool("show_promo", false);
setShowPromoBanner(show);
}
});
// Clean up when no longer needed
unsubscribe();
Full Example
import { AppDNA } from "@appdna/react-native-sdk";
import React, { useEffect, useState } from "react";
import { View, Text } from "react-native";
function HomeScreen() {
const [title, setTitle] = useState("Welcome");
const [showBanner, setShowBanner] = useState(false);
const [bannerText, setBannerText] = useState("");
useEffect(() => {
loadConfig();
const unsubscribe = AppDNA.remoteConfig.onConfigUpdated(() => {
loadConfig();
});
return () => unsubscribe();
}, []);
function loadConfig() {
setTitle(AppDNA.remoteConfig.getString("home_title", "Welcome"));
setShowBanner(AppDNA.remoteConfig.getBool("show_promo_banner", false));
setBannerText(AppDNA.remoteConfig.getString("promo_banner_text", ""));
}
return (
<View>
<Text>{title}</Text>
{showBanner && <Text>{bannerText}</Text>}
</View>
);
}
Remote config values are managed in the Console under Settings > Remote Config. Changes take effect on the next SDK config refresh.