java.lang.Object | |
↳ | com.google.firebase.remoteconfig.FirebaseRemoteConfig |
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()
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DEFAULT_VALUE_FOR_BYTE_ARRAY |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Activates the Fetched Config, so that the fetched key-values take effect.
| |||||||||||
Fetches parameter values for your app.
| |||||||||||
Fetches parameter values for your app.
| |||||||||||
Gets the value corresponding to the specified key, as a boolean,
in the specified namespace.
| |||||||||||
Gets the value corresponding to the specified key, as a boolean.
| |||||||||||
Gets the value corresponding to the specified key, in the specified namespace,
as a byte array.
| |||||||||||
Gets the value corresponding to the specified key, as a byte array.
| |||||||||||
Gets the value corresponding to the specified key, in the specified
namespace, as a double.
| |||||||||||
Gets the value corresponding to the specified key, as a double.
| |||||||||||
Gets the current state of the FirebaseRemoteConfig singleton object.
| |||||||||||
Getter for the singleton FirebaseRemoteConfig object.
| |||||||||||
Gets the set of keys that start with the given prefix, in the given namespace.
| |||||||||||
Gets the set of keys that start with the given prefix.
| |||||||||||
Gets the value corresponding to the specified key, as a long.
| |||||||||||
Gets the value corresponding to the specified key, in the specified
namespace, as a long.
| |||||||||||
Gets the value corresponding to the specified key, as a String.
| |||||||||||
Gets value as a string corresponding to the specified key
in the specified namespace.
| |||||||||||
Gets the
FirebaseRemoteConfigValue corresponding to the specified key. | |||||||||||
Gets the
FirebaseRemoteConfigValue corresponding to the specified key. | |||||||||||
Changes the settings for the FirebaseRemoteConfig object's operations,
such as turning the developer mode on.
| |||||||||||
Sets defaults in the default namespace, using an XML resource.
| |||||||||||
Sets defaults in the default namespace.
| |||||||||||
Set defaults in the given namespace, using an XML resource file.
| |||||||||||
Sets defaults in the default namespace.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Indicates that the most recent attempt to fetch parameter values from the Remote Config Server has failed.
Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Remote Config Server.
Indicates that the most recent fetch of parameter values from the Remote Config Server was completed successfully.
Indicates that the most recent attempt to fetch parameter values from the Remote Config Server was throttled.
Indicates that the value returned was retrieved from the Default Config.
Indicates that the value returned was retrieved from the Remote Config Server.
Indicates that the value returned is the static default value.
Activates the Fetched Config, so that the fetched key-values take effect.
Returns | |
---|---|
boolean |
true if there was a Fetched Config, and it was activated.
false if no Fetched Config was found, or the Fetched Config was
already activated.
|
Fetches parameter values for your app. Configuration values may be served from the Default Config (local cache) or from the Remote Config Server, depending on how much time has elapsed since parameter values were last fetched from the Remote Config server. This method lets the caller specify the cache expiration in seconds.
Parameters | |
---|---|
cacheExpirationSeconds |
long :
If the data in the cache was fetched no longer
than this many seconds ago, this method will
return the cached data. If not, a fetch from
the Remote Config Server will be attempted. |
Returns | |
---|---|
Task<Void> |
A Task object to track the fetch result.
|
Fetches parameter values for your app. Parameter values may be from the Default Config (local cache), or from the Remote Config Server, depending on how much time has elapsed since parameter values were last fetched from the Remote Config server. This method uses the default cache expiration of 12 hours.
Returns | |
---|---|
Task<Void> |
A Task object to track the fetch result.
|
Gets the value corresponding to the specified key, as a boolean, in the specified namespace.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
boolean |
Value as a boolean if a value corresponding
to the look up key was present and could
be converted to a boolean; default (if set)
or static default value otherwise.
"1", "true", "t", "yes", "y",
and "on" are strings that are interpreted
(case insensitive) as |
Gets the value corresponding to the specified key, as a boolean.
This method uses the default namespace. To query in another
namespace, use the getBoolean(String, String)
method.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
boolean |
Value as a boolean if a value corresponding
to the look up key was present and could
be converted to a boolean; default (if set)
or static default value otherwise.
"1", "true", "t", "yes", "y",
and "on" are strings that are interpreted
(case insensitive) as |
Gets the value corresponding to the specified key, in the specified namespace, as a byte array.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
byte[] |
Value as a byte array if a value corresponding to the look up key was present; default (if set) or static default value otherwise. |
Gets the value corresponding to the specified key, as a byte array.
This method uses the default namespace. To query in another
namespace, use the getByteArray(String, String)
method.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
byte[] |
Value as a byte array if a value corresponding to the look up key was present; default (if set) or static default value otherwise. |
Gets the value corresponding to the specified key, in the specified namespace, as a double.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
double |
Value as a double if a value corresponding to the look up key was present and could be converted to a double; default (if set) or static default value otherwise. |
Gets the value corresponding to the specified key, as a double.
This method uses the default namespace. To query in another
namespace, use getDouble(String, String)
.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
double |
Value as a double if a value corresponding to the look up key was present and could be converted to a double; default (if set) or static default value otherwise. |
Gets the current state of the FirebaseRemoteConfig singleton object.
Returns | |
---|---|
FirebaseRemoteConfigInfo |
A FirebaseRemoteConfigInfo wrapping the current state.
|
Getter for the singleton FirebaseRemoteConfig object. Clients start by getting this object, and then call all of the FirebaseRemoteConfig API methods on this object.
Note: If you test your 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.
FirebaseRemoteConfig uses the default FirebaseApp, so if no FirebaseApp
has been initialized yet, this method will throw an
IllegalStateException
.
Returns | |
---|---|
FirebaseRemoteConfig |
Initialized FirebaseRemoteConfig singleton object. |
Gets the set of keys that start with the given prefix, in the given namespace.
Parameters | |
---|---|
prefix |
String :
The key prefix to look for. If empty or null, this method
will return all keys in the given namespace. |
namespace |
String :
The namespace in which to look up the keys. |
Returns | |
---|---|
Set<String> |
Set of Remote Config parameter keys that start with the specified prefix. Will return an empty set if there are no keys with the given prefix. |
Gets the set of keys that start with the given prefix.
This method uses the default namespace. To query in another
namespace, use getKeysByPrefix(String, String)
.
Parameters | |
---|---|
prefix |
String :
The key prefix to look for. If empty or null, this method
will return all keys. |
Returns | |
---|---|
Set<String> |
Set of Remote Config parameter keys that start with the specified prefix. Will return an empty set if there are no keys with the given prefix. |
Gets the value corresponding to the specified key, as a long.
This method uses the default namespace. To query in another
namespace, use getLong(String, String)
.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
long |
Value as a long if a value corresponding to the look up key was present and could be converted to a long; default (if set) or static default value otherwise. |
Gets the value corresponding to the specified key, in the specified namespace, as a long.
Parameters | |
---|---|
key |
String :
The Remote Config parameter config key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
long |
Value as a long if a value corresponding to the look up key was present and could be converted to a long; default (if set) or static default value otherwise. |
Gets the value corresponding to the specified key, as a String.
This method uses the default namespace. To query in another
namespace, use the getString(String, String)
method.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
String |
Value as a String if a value corresponding to the look up key was present; default (if set) or static default value otherwise. |
Gets value as a string corresponding to the specified key in the specified namespace.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
String |
Value as a string if a value corresponding to the look up key was present and could be converted to a string; default (if set) or static default value otherwise. |
Gets the FirebaseRemoteConfigValue
corresponding to the specified key.
This method uses the default namespace. To query in another
namespace, use getValue(String, String)
.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
Returns | |
---|---|
FirebaseRemoteConfigValue |
The corresponding FirebaseRemoteConfigValue object.
|
Gets the FirebaseRemoteConfigValue
corresponding to the specified key.
Parameters | |
---|---|
key |
String :
The Remote Config parameter key to look up. |
namespace |
String :
The namespace in which to look up the key. |
Returns | |
---|---|
FirebaseRemoteConfigValue |
The corresponding FirebaseRemoteConfigValue object.
|
Changes the settings for the FirebaseRemoteConfig object's operations, such as turning the developer mode on.
Parameters | |
---|---|
settings |
FirebaseRemoteConfigSettings :
The new settings to be applied. If null
is passed, it will clear all current settings.
|
Sets defaults in the default namespace, using an XML resource.
Parameters | |
---|---|
resourceId |
int :
Id for the XML resource, which should be in your application's res/xml
folder.
|
Sets defaults in the default namespace.
Parameters | |
---|---|
defaults |
Map :
Key value map to be used for setting the defaults. The values in this map
should be one of the types Long , String ,
Double , byte[] , or Boolean . |
namespace |
String :
The namespace in which to set the defaults.
|
Set defaults in the given namespace, using an XML resource file.
Parameters | |
---|---|
resourceId |
int :
Id for the XML resource, which should be in your application's res/xml
folder. |
namespace |
String :
The namespace in which to set the defaults.
|
Sets defaults in the default namespace. To set defaults in a different namespace,
use setDefaults(java.util.Map, String)
.
Parameters | |
---|---|
defaults |
Map :
Key value map to be used for setting the defaults. The values in this map
should be one of the types Long , String ,
Double , byte[] , or Boolean .
|