Go to console

Firebase Remote Config API Overview

Firebase Remote Config has APIs that make it easy to change the behavior and appearance of your app without requiring users to download an app update. This overview describes the following:

  • Key features of the Remote Config APIs.
  • The Remote Config library and API architecture.

To learn more about Remote Config, see the Remote Config introduction.

Key Features of the Remote Config APIs

Remote Config APIs implement the following features:

  • Your app controls when new parameter values are applied. Because changes to parameter values affect the behavior and appearance of your app, the API design implements a singleton object that fetches values in the background, stores them locally, and then lets your app activate them at the right time.
  • In-app default parameter values. You set in-app default values for all Remote Config parameters in your app. These values are available to your app immediately, even if a device does not have connectivity. You get fetched and activated values using the same methods that you use to get in-app default values.
  • Fetching and applying values is efficient. Fetching and activating values from the Remote Config service is efficient and can be done safely and repeatedly, so there is no need to add logic to your app that listens for a callback or that determines if it is safe to activate fetched values. In fact, you can write your app so that it sends a request to fetch parameter values and activates any previously fetched parameter values each time that a user starts your app, or even more frequently than that. If no fetched and activated values are available, your app will use in-app default values with a negligible impact on performance from the fetch request or the call to activate().

Remote Config library

The cornerstone of the Remote Config API architecture is the Remote Config Library. The Remote Config Library implements a singleton class, FIRRemoteConfig for iOS and FirebaseRemoteConfig for Android. Use the Remote Config object to do the following:

  • Set default values. You don't need to manage (or even create) parameters in the Remote Config service for your app to work as intended. You can instrument your app with as many Remote Config parameters as you need and create in-app default values. Later, you can override a subset of your app's parameters by creating parameters on the Remote Config service.
  • Fetch, store, and manage parameter values. The Remote Config object contains three stores of parameter values: the Default Config (stores in-app default values), the Active Config (stores values that are available to the app using get methods), and the Fetched Config (stores values most recently fetched from the Remote Config Server).
  • Activate the Fetched Config, which updates the Active Config. When the Fetched Config is activated, the parameter values in the Fetched Config are copied to the Active Config. This makes the recently fetched values available to your app.

API architecture

The following diagram shows how your app interacts with Remote Config.

The following table provides additional details on interactions between your app and the Remote Config Library.

Methods and properties Notes
Get Remote Config object methods:

   iOS: remoteConfig
   Android: getInstance()

Step #1: Your app calls these methods to create the Remote Config object (or have it recovered from persistent storage). If the object was newly created, the Fetched Config, the Active Config, and the Default Config are initially "empty," containing no parameter values.

Note: If you test your Android app using StrictMode, note that the initial getInstance() call on app creation reads from a local file. To avoid StrictMode disk read errors, this initial call should not be made on the UI thread. All subsequent getInstance() calls are safe on the UI thread, because they only read from memory. You should never leave StrictMode enabled in applications distributed on Google Play.

Set Default Config methods:

   iOS: setDefaults():
   Android: setDefaultsAsync()
Step #2: Your app calls these methods to set values in the Default Config. If your app attempts to get a value from a new Remote Config object before that value exists in the Active Config, the value from the Default Config is provided instead.
Fetch methods:

   Android: fetch()
Your app uses these methods to initiate a call to the Remote Config Server and obtain fresh parameter values, which are stored in the Fetched Config.

Note: Fetch methods do not have an immediate effect on the behavior or appearance of your app.
Activate methods:

   iOS: activateFetched()
   Android: activate()
Your app activates the Fetched Config, which copies values stored there to the Active Config.
Get<type> methods:

   iOS: configValueForKey:
   Android: getLong(), getString(), etc.
Your app calls these methods to get parameter values from the Active Config.
Config settings methods:

   iOS: initWithDeveloperModeEnabled:
   Android: setConfigSettingsAsync()
Used for custom settings. Currently used for settings that allow app developers to refresh app data more quickly than is allowed for production apps and to set a fetch timeout (how long the SDK waits for the server response before giving up). To learn more, see iOS caching and throttling on Android.
Info methods and properties:

   iOS: lastFetchStatus, allKeysWithPrefix:
   Android: getConfigSettings(), getLastFetchStatus(), getKeysByPrefix()
Your app uses these methods to get information about the Remote Config object. You can use these methods for debugging during app development.

To learn more about the Remote Config APIs, see:

To get started integrating Remote Config with your app, see Use Remote Config on iOS and Use Remote Config on Android.