Entry point for the Firebase Remote Config (FRC) API.
Callers should first get the singleton object using getInstance(), and then call
operations on that singleton object. The singleton contains the complete set of FRC parameter
values available to your app. The singleton also stores values fetched from the FRC Server until
they are made available for use with a call to activate().
| boolean | DEFAULT_VALUE_FOR_BOOLEAN | The static default boolean value for any given key. |
| double | DEFAULT_VALUE_FOR_DOUBLE | The static default double value for any given key. |
| long | DEFAULT_VALUE_FOR_LONG | The static default long value for any given key. |
| String | DEFAULT_VALUE_FOR_STRING | The static default string value for any given key. |
| int | LAST_FETCH_STATUS_FAILURE | Indicates that the most recent attempt to fetch parameter values from the Firebase Remote Config Server has failed. |
| int | LAST_FETCH_STATUS_NO_FETCH_YET | Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Firebase Remote Config Server. |
| int | LAST_FETCH_STATUS_SUCCESS | Indicates that the most recent fetch of parameter values from the Firebase Remote Config Server was completed successfully. |
| int | LAST_FETCH_STATUS_THROTTLED | Indicates that the most recent attempt to fetch parameter values from the Firebase Remote Config Server was throttled. |
| int | VALUE_SOURCE_DEFAULT | Indicates that the value returned was retrieved from the defaults set by the client. |
| int | VALUE_SOURCE_REMOTE | Indicates that the value returned was retrieved from the Firebase Remote Config Server. |
| int | VALUE_SOURCE_STATIC | Indicates that the value returned is the static default value. |
| public static final byte[] | DEFAULT_VALUE_FOR_BYTE_ARRAY | The static default byte array value for any given key. |
| Task<Boolean> |
activate()
Asynchronously activates the most recently fetched configs, so that the fetched key value pairs
take effect.
|
| Task<FirebaseRemoteConfigInfo> |
ensureInitialized()
Returns a
Task representing the initialization status of this Firebase Remote Config
instance. |
| Task<Void> |
fetch(long minimumFetchIntervalInSeconds)
Starts fetching configs, adhering to the specified minimum fetch interval.
|
| Task<Void> |
fetch()
Starts fetching configs, adhering to the default minimum fetch interval.
|
| Task<Boolean> |
fetchAndActivate()
Asynchronously fetches and then activates the fetched configs.
|
| Map<String, FirebaseRemoteConfigValue> | |
| boolean | |
| double | |
| FirebaseRemoteConfigInfo |
getInfo()
Returns the state of this
FirebaseRemoteConfig instance as a FirebaseRemoteConfigInfo. |
| static FirebaseRemoteConfig |
getInstance()
Returns a singleton instance of Firebase Remote Config.
|
| static FirebaseRemoteConfig |
getInstance(FirebaseApp app)
Returns an instance of Firebase Remote Config for the given
FirebaseApp. |
| Set<String> |
getKeysByPrefix(String prefix)
Returns a
Set of all Firebase Remote Config parameter keys with the given prefix. |
| long | |
| String | |
| FirebaseRemoteConfigValue | |
| Task<Void> |
reset()
Deletes all activated, fetched and defaults configs and resets all Firebase Remote Config
settings.
|
| Task<Void> |
setConfigSettingsAsync(FirebaseRemoteConfigSettings settings)
Asynchronously changes the settings for this
FirebaseRemoteConfig instance. |
| Task<Void> |
setDefaultsAsync(int resourceId)
Sets default configs using an XML resource.
|
| Task<Void> |
setDefaultsAsync(Map<String, Object> defaults)
Asynchronously sets default configs using the given
Map. |
The static default boolean value for any given key.
The static default double value for any given key.
The static default long value for any given key.
The static default string value for any given key.
Indicates that the most recent attempt to fetch parameter values from the Firebase Remote Config Server has failed.
Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Firebase Remote Config Server.
Indicates that the most recent fetch of parameter values from the Firebase Remote Config Server was completed successfully.
Indicates that the most recent attempt to fetch parameter values from the Firebase Remote Config Server was throttled.
Indicates that the value returned was retrieved from the defaults set by the client.
Indicates that the value returned was retrieved from the Firebase Remote Config Server.
Indicates that the value returned is the static default value.
The static default byte array value for any given key.
Returns a Task representing the initialization status of this Firebase Remote Config
instance.
Starts fetching configs, adhering to the specified minimum fetch interval.
The fetched configs only take effect after the next activate() call.
Depending on the time elapsed since the last fetch from the Firebase Remote Config backend, configs are either served from local storage, or fetched from the backend.
Note: Also initializes the Firebase installations SDK that creates installation IDs to
identify Firebase installations and periodically sends data to Firebase servers. Remote Config
requires installation IDs for Fetch requests. To stop the periodic sync, call delete(). Sending a Fetch request
after deletion will create a new installation ID for this Firebase installation and resume the
periodic sync.
| minimumFetchIntervalInSeconds | If configs in the local storage were fetched more than this many seconds ago, configs are served from the backend instead of local storage. |
|---|
Task representing the fetch call.
Starts fetching configs, adhering to the default minimum fetch interval.
The fetched configs only take effect after the next activate() call.
Depending on the time elapsed since the last fetch from the Firebase Remote Config backend,
configs are either served from local storage, or fetched from the backend. The default minimum
fetch interval can be set with FirebaseRemoteConfigSettings.Builder#setMinimumFetchIntervalInSeconds(long); the static
default is 12 hours.
Note: Also initializes the Firebase installations SDK that creates installation IDs to
identify Firebase installations and periodically sends data to Firebase servers. Remote Config
requires installation IDs for Fetch requests. To stop the periodic sync, call delete(). Sending a Fetch request
after deletion will create a new installation ID for this Firebase installation and resume the
periodic sync.
Task representing the fetch call.
Asynchronously fetches and then activates the fetched configs.
If the time elapsed since the last fetch from the Firebase Remote Config backend is more than the default minimum fetch interval, configs are fetched from the backend.
After the fetch is complete, the configs are activated so that the fetched key value pairs take effect.
Returns a Map of Firebase Remote Config key value pairs.
Evaluates the values of the parameters in the following order:
activate() contained the key.
setDefaultsAsync.
Returns the parameter value for the given key as a boolean.
Evaluates the value of the parameter in the following order:
activate() contained the key, and
the value can be converted into a boolean.
setDefaultsAsync, and the value can be converted into a boolean.
DEFAULT_VALUE_FOR_BOOLEAN.
"1", "true", "t", "yes", "y", and "on" are strings that are interpreted (case insensitive)
as true, and "0", "false", "f", "no", "n", "off", and empty string are interpreted
(case insensitive) as false.
| key | A Firebase Remote Config parameter key with a boolean parameter value. |
|---|
boolean representing the value of the Firebase Remote Config parameter with the
given key.
Returns the parameter value for the given key as a double.
Evaluates the value of the parameter in the following order:
activate() contained the key, and
the value can be converted into a double.
setDefaultsAsync, and the value can be converted into a double.
DEFAULT_VALUE_FOR_DOUBLE.
| key | A Firebase Remote Config parameter key with a double parameter value. |
|---|
double representing the value of the Firebase Remote Config parameter with the
given key.
Returns the state of this FirebaseRemoteConfig instance as a FirebaseRemoteConfigInfo.
Returns a singleton instance of Firebase Remote Config.
FirebaseRemoteConfig uses the default FirebaseApp, so if no FirebaseApp has been initialized yet, this method throws an IllegalStateException.
Note: Also initializes the Firebase installations SDK that creates installation IDs to
identify Firebase installations and periodically sends data to Firebase servers. Remote Config
requires installation IDs for Fetch requests. To stop the periodic sync, call delete(). Sending a Fetch request
after deletion will create a new installation ID for this Firebase installation and resume the
periodic sync.
FirebaseRemoteConfig for the default FirebaseApp.
Returns an instance of Firebase Remote Config for the given FirebaseApp.
| app |
|---|
Returns the parameter value for the given key as a long.
Evaluates the value of the parameter in the following order:
activate() contained the key, and
the value can be converted into a long.
setDefaultsAsync, and the value can be converted into a long.
DEFAULT_VALUE_FOR_LONG.
| key | A Firebase Remote Config parameter key with a long parameter value. |
|---|
long representing the value of the Firebase Remote Config parameter with the
given key.
Returns the parameter value for the given key as a String.
Evaluates the value of the parameter in the following order:
activate() contained the key.
setDefaultsAsync.
DEFAULT_VALUE_FOR_STRING.
| key | A Firebase Remote Config parameter key. |
|---|
String representing the value of the Firebase Remote Config parameter with the
given key.
Returns the parameter value for the given key as a FirebaseRemoteConfigValue.
Evaluates the value of the parameter in the following order:
activate() contained the key.
setDefaultsAsync.
FirebaseRemoteConfigValue that returns the static value for each type.
| key | A Firebase Remote Config parameter key. |
|---|
FirebaseRemoteConfigValue representing the value of the Firebase Remote Config
parameter with the given key.
Deletes all activated, fetched and defaults configs and resets all Firebase Remote Config settings.
Task representing the clear call.
Asynchronously changes the settings for this FirebaseRemoteConfig instance.
| settings | The new settings to be applied. |
|---|
Sets default configs using an XML resource.
| resourceId | Id for the XML resource, which should be in your application's res/xml folder.
|
|---|