FirebaseRemoteConfig

public class FirebaseRemoteConfig extends Object

Entry point for FirebaseRemoteConfig. Callers should first get the singleton object using getInstance(), and then call the operations on that singleton object. The singleton object contains the complete set of Remote Config parameter values available to your app, including the Active Config and Default Config. This object also caches values fetched from the Remote Config Server until they are copied to the Active Config by calling activateFetched().

Constant Summary

boolean DEFAULT_VALUE_FOR_BOOLEAN
double DEFAULT_VALUE_FOR_DOUBLE
long DEFAULT_VALUE_FOR_LONG
String DEFAULT_VALUE_FOR_STRING
int LAST_FETCH_STATUS_FAILURE Indicates that the most recent attempt to fetch parameter values from the 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 Remote Config Server.
int LAST_FETCH_STATUS_SUCCESS Indicates that the most recent fetch of parameter values from the Remote Config Server was completed successfully.
int LAST_FETCH_STATUS_THROTTLED Indicates that the most recent attempt to fetch parameter values from the Remote Config Server was throttled.
int VALUE_SOURCE_DEFAULT Indicates that the value returned was retrieved from the Default Config.
int VALUE_SOURCE_REMOTE Indicates that the value returned was retrieved from the Remote Config Server.
int VALUE_SOURCE_STATIC Indicates that the value returned is the static default value.

Field Summary

public static final byte[] DEFAULT_VALUE_FOR_BYTE_ARRAY

Public Method Summary

boolean
activateFetched()
Activates the Fetched Config, so that the fetched key-values take effect.
Task<Void>
fetch(long cacheExpirationSeconds)
Fetches parameter values for your app.
Task<Void>
fetch()
Fetches parameter values for your app.
boolean
getBoolean(String key, String namespace)
Gets the value corresponding to the specified key, as a boolean, in the specified namespace.
boolean
getBoolean(String key)
Gets the value corresponding to the specified key, as a boolean.
byte[]
getByteArray(String key, String namespace)
Gets the value corresponding to the specified key, in the specified namespace, as a byte array.
byte[]
getByteArray(String key)
Gets the value corresponding to the specified key, as a byte array.
double
getDouble(String key, String namespace)
Gets the value corresponding to the specified key, in the specified namespace, as a double.
double
getDouble(String key)
Gets the value corresponding to the specified key, as a double.
FirebaseRemoteConfigInfo
getInfo()
Gets the current state of the FirebaseRemoteConfig singleton object.
static FirebaseRemoteConfig
getInstance()
Getter for the singleton FirebaseRemoteConfig object.
Set<String>
getKeysByPrefix(String prefix, String namespace)
Gets the set of keys that start with the given prefix, in the given namespace.
Set<String>
getKeysByPrefix(String prefix)
Gets the set of keys that start with the given prefix.
long
getLong(String key)
Gets the value corresponding to the specified key, as a long.
long
getLong(String key, String namespace)
Gets the value corresponding to the specified key, in the specified namespace, as a long.
String
getString(String key)
Gets the value corresponding to the specified key, as a String.
String
getString(String key, String namespace)
Gets value as a string corresponding to the specified key in the specified namespace.
FirebaseRemoteConfigValue
getValue(String key)
Gets the FirebaseRemoteConfigValue corresponding to the specified key.
FirebaseRemoteConfigValue
getValue(String key, String namespace)
Gets the FirebaseRemoteConfigValue corresponding to the specified key.
void
setConfigSettings(FirebaseRemoteConfigSettings settings)
Changes the settings for the FirebaseRemoteConfig object's operations, such as turning the developer mode on.
void
setDefaults(int resourceId)
Sets defaults in the default namespace, using an XML resource.
void
setDefaults(Map<StringObject> defaults, String namespace)
Sets defaults in the default namespace.
void
setDefaults(int resourceId, String namespace)
Set defaults in the given namespace, using an XML resource file.
void
setDefaults(Map<StringObject> defaults)
Sets defaults in the default namespace.

Inherited Method Summary

Constants

public static final boolean DEFAULT_VALUE_FOR_BOOLEAN

Constant Value: false

public static final double DEFAULT_VALUE_FOR_DOUBLE

Constant Value: 0.0

public static final long DEFAULT_VALUE_FOR_LONG

Constant Value: 0

public static final String DEFAULT_VALUE_FOR_STRING

Constant Value: ""

public static final int LAST_FETCH_STATUS_FAILURE

Indicates that the most recent attempt to fetch parameter values from the Remote Config Server has failed.

Constant Value: 1

public static final int LAST_FETCH_STATUS_NO_FETCH_YET

Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Remote Config Server.

Constant Value: 0

public static final int LAST_FETCH_STATUS_SUCCESS

Indicates that the most recent fetch of parameter values from the Remote Config Server was completed successfully.

Constant Value: -1

public static final int LAST_FETCH_STATUS_THROTTLED

Indicates that the most recent attempt to fetch parameter values from the Remote Config Server was throttled.

Constant Value: 2

public static final int VALUE_SOURCE_DEFAULT

Indicates that the value returned was retrieved from the Default Config.

Constant Value: 1

public static final int VALUE_SOURCE_REMOTE

Indicates that the value returned was retrieved from the Remote Config Server.

Constant Value: 2

public static final int VALUE_SOURCE_STATIC

Indicates that the value returned is the static default value.

Constant Value: 0

Fields

public static final byte[] DEFAULT_VALUE_FOR_BYTE_ARRAY

Public Methods

public boolean activateFetched ()

Activates the Fetched Config, so that the fetched key-values take effect.

Returns
  • true if there was a Fetched Config, and it was activated. false if no Fetched Config was f