firebase::remote_config

Firebase Remote Config API.

Summary

Firebase Remote Config is a cloud service that lets you change the appearance and behavior of your app without requiring users to download an app update.

Enumerations

ConfigSetting{
  kConfigSettingDeveloperMode
}
enum
Keys of API settings.
FetchFailureReason{
  kFetchFailureReasonInvalid,
  kFetchFailureReasonThrottled,
  kFetchFailureReasonError
}
enum
Describes the most recent fetch failure.
LastFetchStatus{
  kLastFetchStatusSuccess,
  kLastFetchStatusFailure,
  kLastFetchStatusPending
}
enum
Describes the most recent fetch request status.
ValueSource{
  kValueSourceStaticValue,
  kValueSourceRemoteValue,
  kValueSourceDefaultValue
}
enum
Describes the source a config value was retrived from.

Functions

ActivateFetched()
bool
Applies the most recently fetched data, so that its values can be accessed.
Fetch()
Future< void >
Fetches config data from the server.
Fetch(uint64_t cache_expiration_in_seconds)
Future< void >
Fetches config data from the server.
FetchLastResult()
Future< void >
Get the (possibly still pending) results of the most recent Fetch() call.
GetBoolean(const char *key)
bool
Returns the value associated with a key, converted to a bool.
GetBoolean(const char *key, const char *config_namespace)
bool
Returns the value associated with a key, converted to a bool.
GetBoolean(const char *key, ValueInfo *info)
bool
Returns the value associated with a key, converted to a bool.
GetBoolean(const char *key, const char *config_namespace, ValueInfo *info)
bool
Returns the value associated with a key, converted to a bool.
GetConfigSetting(ConfigSetting setting)
std::string
Retrieve an internal configuration setting.
GetData(const char *key)
std::vector< unsigned char >
Returns the value associated with a key, as a vector of raw byte-data.
GetData(const char *key, const char *config_namespace)
std::vector< unsigned char >
Returns the value associated with a key, as a vector of raw byte-data.
GetData(const char *key, ValueInfo *info)
std::vector< unsigned char >
Returns the value associated with a key, as a vector of raw byte-data.
GetData(const char *key, const char *config_namespace, ValueInfo *info)
std::vector< unsigned char >
Returns the value associated with a key, as a vector of raw byte-data.
GetDouble(const char *key)
double
Returns the value associated with a key, converted to a double.
GetDouble(const char *key, const char *config_namespace)
double
Returns the value associated with a key, converted to a double.
GetDouble(const char *key, ValueInfo *info)
double
Returns the value associated with a key, converted to a double.
GetDouble(const char *key, const char *config_namespace, ValueInfo *info)
double
Returns the value associated with a key, converted to a double.
GetInfo()
const ConfigInfo &
Returns information about the last fetch request, in the form of a ConfigInfo struct.
GetKeys()
std::vector< std::string >
Gets the set of all keys in the default namespace.
GetKeys(const char *config_namespace)
std::vector< std::string >
Gets the set of all keys in the given namespace.
GetKeysByPrefix(const char *prefix)
std::vector< std::string >
Gets the set of keys that start with the given prefix, in the default namespace.
GetKeysByPrefix(const char *prefix, const char *config_namespace)
std::vector< std::string >
Gets the set of keys that start with the given prefix, in the given namespace.
GetLong(const char *key)
int64_t
Returns the value associated with a key, converted to a 64-bit integer.
GetLong(const char *key, const char *config_namespace)
int64_t
Returns the value associated with a key, converted to a 64-bit integer.
GetLong(const char *key, ValueInfo *info)
int64_t
Returns the value associated with a key, converted to a 64-bit integer.
GetLong(const char *key, const char *config_namespace, ValueInfo *info)
int64_t
Returns the value associated with a key, converted to a 64-bit integer.
GetString(const char *key)
std::string
Returns the value associated with a key, converted to a string.
GetString(const char *key, const char *config_namespace)
std::string
Returns the value associated with a key, converted to a string.
GetString(const char *key, ValueInfo *info)
std::string
Returns the value associated with a key, converted to a string.
GetString(const char *key, const char *config_namespace, ValueInfo *info)
std::string
Returns the value associated with a key, converted to a string.
Initialize(const App & app)
Initialize the RemoteConfig API.
SetConfigSetting(ConfigSetting setting, const char *value)
void
Sets an internal configuration setting.
SetDefaults(int defaults_resource_id)
void
Sets the default values, using an XML resource.
SetDefaults(int defaults_resource_id, const char *defaults_namespace)
void
Sets the default values, using an XML resource.
SetDefaults(const ConfigKeyValueVariant *defaults, size_t number_of_defaults)
void
Sets the default values based on a mapping of string to Variant.
SetDefaults(const ConfigKeyValueVariant *defaults, size_t number_of_defaults, const char *config_namespace)
void
Sets the default values based on a mapping of string to Variant.
SetDefaults(const ConfigKeyValue *defaults, size_t number_of_defaults)
void
Sets the default values based on a string map.
SetDefaults(const ConfigKeyValue *defaults, size_t number_of_defaults, const char *config_namespace)
void
Sets the default values based on a string map.
Terminate()
void
Terminate the RemoteConfig API.

Structs

firebase::remote_config::ConfigInfo

Describes the state of the most recent Fetch() call.

firebase::remote_config::ConfigKeyValue

Describes a mapping of a key to a string value.

firebase::remote_config::ConfigKeyValueVariant

Describes a mapping of a key to a value of any type.

firebase::remote_config::ValueInfo

Describes a retrieved value.

Enumerations

ConfigSetting

 ConfigSetting

Keys of API settings.

See also: SetConfigSetting See also: GetConfigSetting

Properties
kConfigSettingDeveloperMode

Set the value associated with this key to "1" to enable developer mode (i.e disable throttling) and "0" to disable.

FetchFailureReason

 FetchFailureReason

Describes the most recent fetch failure.

Properties
kFetchFailureReasonError

The most recent fetch failed for an unknown reason.

kFetchFailureReasonInvalid

The fetch has not yet failed.

kFetchFailureReasonThrottled

The most recent fetch failed because it was throttled by the server.

(You are sending too many fetch requests in too short a time.)

LastFetchStatus

 LastFetchStatus

Describes the most recent fetch request status.

Properties
kLastFetchStatusFailure

The most recent fetch request failed.

kLastFetchStatusPending

The most recent fetch is still in progress.

kLastFetchStatusSuccess

The most recent fetch was a success, and its data is ready to be applied, if you have not already done so.

ValueSource

 ValueSource

Describes the source a config value was retrived from.

Properties
kValueSourceDefaultValue

The value was not specified, so the specified default value was returned instead.

kValueSourceRemoteValue

The value was found in the remote data store, and returned.

kValueSourceStaticValue

The value was not specified and no default was specified, so a static value (0 for numeric values, an empty string for strings) was returned.

Functions

ActivateFetched

bool ActivateFetched()

Applies the most recently fetched data, so that its values can be accessed.

Calls to GetLong(), GetDouble(), GetString() and GetData() will not reflect the new data retrieved by Fetch() until ActivateFetched() is called. This gives the developer control over when newly fetched data is visible to their application.

Details
Returns
true if a previously fetch configuration was activated, false if a fetched configuration wasn't found or the configuration was previously activated.

Fetch

Future< void > Fetch()

Fetches config data from the server.

Note:This does not actually apply the data or make it accessible, it merely retrieves it and caches it. To accept and access the newly retrieved values, you must call ActivateFetched(). Note that this function is asynchronous, and will normally take an unspecified amount of time before completion.

Details
Returns
A Future which can be used to determine when the fetch is complete.

Fetch

Future< void > Fetch(
  uint64_t cache_expiration_in_seconds
)

Fetches config data from the server.

Note:This does not actually apply the data or make it accessible, it merely retrieves it and caches it. To accept and access the newly retrieved values, you must call ActivateFetched(). Note that this function is asynchronous, and will normally take an unspecified amount of time before completion.

Details
Parameters
cache_expiration_in_seconds
The number of seconds to keep previously fetch data available. If cached data is available that is newer than cache_expiration_in_seconds, then the function returns immediately and does not fetch any data. A cache_expiration_in_seconds of zero will always cause a fetch.
Returns
A Future which can be used to determine when the fetch is complete.

FetchLastResult

Future< void > FetchLastResult()

Get the (possibly still pending) results of the most recent Fetch() call.

Details
Returns
The future result from the last call to Fetch().

GetBoolean

bool GetBoolean(
  const char *key
)

Returns the value associated with a key, converted to a bool.

Values of "1", "true", "t", "yes", "y" and "on" are interpreted (case insensitive) as true and "0", "false", "f", "no", "n", "off", and empty strings are interpreted (case insensitive) as false.

Details
Parameters
key
Key of the value to be retrieved.
Returns
Value associated with the specified key converted to a boolean value.

GetBoolean

bool GetBoolean(
  const char *key,
  const char *config_namespace
)

Returns the value associated with a key, converted to a bool.

Values of "1", "true", "t", "yes", "y" and "on" are interpreted (case insensitive) as true and "0", "false", "f", "no", "n", "off", and empty strings are interpreted (case insensitive) as false.

Details
Parameters
key
Key of the value to be retrieved.
config_namespace
Namespace to query for the key.
Returns
Value associated with the specified key converted to a boolean value.

GetBoolean

bool GetBoolean(
  const char *key,
  ValueInfo *info
)

Returns the value associated with a key, converted to a bool.

Values of "1", "true", "t", "yes", "y" and "on" are interpreted (case insensitive) as true and "0", "false", "f", "no", "n", "off", and empty strings are interpreted (case insensitive) as false.

Details
Parameters
key
Key of the value to be retrieved.
info
A return value, specifying the source of the returned value.
Returns
Value associated with the specified key converted to a boolean value.

GetBoolean

bool GetBoolean(
  const char *key,
  const char *config_namespace,
  ValueInfo *info
)

Returns the value associated with a key, converted to a bool.

Values of "1", "true", "t", "yes", "y" and "on" are interpreted (case insensitive) as true and "0", "false", "f", "no", "n", "off", and empty strings are interpreted (case insensitive) as false.

Details
Parameters
key
Key of the value to be retrieved.
config_namespace
Namespace to query for the key.
info
A return value, specifying the source of the returned value.
Returns
Value associated with the specified key converted to a boolean value.

GetConfigSetting

std::string GetConfigSetting(
  ConfigSetting setting
)

Retrieve an internal configuration setting.

See also: SetConfigSetting

Details
Parameters
setting
Setting to retrieve.
Returns
The value of the config

GetData

std::vector< unsigned char > GetData(
  const char *key
)

Returns the value associated with a key, as a vector of raw byte-data.

Details
Parameters
key
Key of the value to be retrieved.
Returns
Vector of bytes.

GetData

std::vector< unsigned char > GetData(
  const char *key,
  const char *config_namespace
)

Returns the value associated with a key, as a vector of raw byte-data.

Details
Parameters
key
Key of the value to be retrieved.
config_namespace
Namespace to query for the key.
Returns
Vector of bytes.

GetData

std::vector< unsigned char > GetData(
  const char *key,
  ValueInfo *info
)

Returns the value associated with a key, as a vector of raw byte-data.

Details
Parameters
key
Key of the value to be retrieved.
info
A return value, specifying the source of the returned value.
Returns
Vector of bytes.

GetData

std::vector< unsigned char > GetData(
  const char *key,
  const char *config_namespace,
  ValueInfo *info
)

Returns the value associated with a key, as a vector of raw byte-data.

Details
Parameters
key
Key of the value to be retrieved.
config_namespace