FirebaseRemoteConfig

public final class FirebaseRemoteConfig extends Object

This class is the entry point for all server-side Firebase Remote Config actions.

You can get an instance of FirebaseRemoteConfig via getInstance(FirebaseApp), and then use it to manage Remote Config templates.

Public Method Summary

Template
forcePublishTemplate(Template template)
Force publishes a Remote Config template.
ApiFuture<Template>
forcePublishTemplateAsync(Template template)
Similar to forcePublishTemplate(Template) but performs the operation asynchronously.
static FirebaseRemoteConfig
getInstance()
Gets the FirebaseRemoteConfig instance for the default FirebaseApp.
synchronized static FirebaseRemoteConfig
getInstance(FirebaseApp app)
Gets the FirebaseRemoteConfig instance for the specified FirebaseApp.
Template
getTemplate()
Gets the current active version of the Remote Config template.
ApiFuture<Template>
getTemplateAsync()
Similar to getTemplate() but performs the operation asynchronously.
Template
getTemplateAtVersion(String versionNumber)
Gets the requested version of the of the Remote Config template.
Template
getTemplateAtVersion(long versionNumber)
Gets the requested version of the of the Remote Config template.
ApiFuture<Template>
getTemplateAtVersionAsync(long versionNumber)
Similar to getTemplateAtVersion(long) but performs the operation asynchronously.
ApiFuture<Template>
getTemplateAtVersionAsync(String versionNumber)
Similar to getTemplateAtVersion(String) but performs the operation asynchronously.
ListVersionsPage
listVersions()
Gets a list of Remote Config template versions that have been published, sorted in reverse chronological order.
ListVersionsPage
listVersions(ListVersionsOptions options)
Gets a list of Remote Config template versions that have been published, sorted in reverse chronological order.
ApiFuture<ListVersionsPage>
listVersionsAsync(ListVersionsOptions options)
Similar to listVersions(ListVersionsOptions) but performs the operation asynchronously.
ApiFuture<ListVersionsPage>
listVersionsAsync()
Similar to listVersions() but performs the operation asynchronously.
Template
publishTemplate(Template template)
Publishes a Remote Config template.
ApiFuture<Template>
publishTemplateAsync(Template template)
Similar to publishTemplate(Template) but performs the operation asynchronously.
Template
rollback(long versionNumber)
Rolls back a project's published Remote Config template to the specified version.
Template
rollback(String versionNumber)
Rolls back a project's published Remote Config template to the specified version.
ApiFuture<Template>
rollbackAsync(String versionNumber)
Similar to rollback(String) but performs the operation asynchronously.
ApiFuture<Template>
rollbackAsync(long versionNumber)
Similar to rollback(long) but performs the operation asynchronously.
Template
validateTemplate(Template template)
Validates a Remote Config template.
ApiFuture<Template>
validateTemplateAsync(Template template)
Similar to validateTemplate(Template) but performs the operation asynchronously.

Inherited Method Summary

Public Methods

public Template forcePublishTemplate (Template template)

Force publishes a Remote Config template.

This method forces the Remote Config template to be updated without evaluating the ETag values. This approach is not recommended because it risks causing the loss of updates to your Remote Config template if multiple clients are updating the Remote Config template. See ETag usage and forced updates.

Parameters
template The Remote Config template to be forcefully published.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while publishing the template.

public ApiFuture<Template> forcePublishTemplateAsync (Template template)

Similar to forcePublishTemplate(Template) but performs the operation asynchronously.

Parameters
template The Remote Config template to be forcefully published.
Returns
  • An ApiFuture that completes with a Template when the provided template is published.

public static FirebaseRemoteConfig getInstance ()

Gets the FirebaseRemoteConfig instance for the default FirebaseApp.

Returns

public static synchronized FirebaseRemoteConfig getInstance (FirebaseApp app)

Gets the FirebaseRemoteConfig instance for the specified FirebaseApp.

Returns

public Template getTemplate ()

Gets the current active version of the Remote Config template.

Returns
Throws
FirebaseRemoteConfigException If an error occurs while getting the template.

public ApiFuture<Template> getTemplateAsync ()

Similar to getTemplate() but performs the operation asynchronously.

Returns
  • An ApiFuture that completes with a Template when the template is available.

public Template getTemplateAtVersion (String versionNumber)

Gets the requested version of the of the Remote Config template.

Parameters
versionNumber The version number of the Remote Config template to get.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while getting the template.

public Template getTemplateAtVersion (long versionNumber)

Gets the requested version of the of the Remote Config template.

Parameters
versionNumber The version number of the Remote Config template to get.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while getting the template.

public ApiFuture<Template> getTemplateAtVersionAsync (long versionNumber)

Similar to getTemplateAtVersion(long) but performs the operation asynchronously.

Parameters
versionNumber The version number of the Remote Config template to get.
Returns
  • An ApiFuture that completes with a Template when the requested template is available.

public ApiFuture<Template> getTemplateAtVersionAsync (String versionNumber)

Similar to getTemplateAtVersion(String) but performs the operation asynchronously.

Parameters
versionNumber The version number of the Remote Config template to get.
Returns
  • An ApiFuture that completes with a Template when the requested template is available.

public ListVersionsPage listVersions ()

Gets a list of Remote Config template versions that have been published, sorted in reverse chronological order. Only the last 300 versions are stored.

Returns
Throws
FirebaseRemoteConfigException If an error occurs while retrieving versions list.

public ListVersionsPage listVersions (ListVersionsOptions options)

Gets a list of Remote Config template versions that have been published, sorted in reverse chronological order. Only the last 300 versions are stored.

Parameters
options List version options.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while retrieving versions list.

public ApiFuture<ListVersionsPage> listVersionsAsync (ListVersionsOptions options)

Similar to listVersions(ListVersionsOptions) but performs the operation asynchronously.

Parameters
options List version options.
Returns

public ApiFuture<ListVersionsPage> listVersionsAsync ()

Similar to listVersions() but performs the operation asynchronously.

Returns

public Template publishTemplate (Template template)

Publishes a Remote Config template.

Parameters
template The Remote Config template to be published.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while publishing the template.

public ApiFuture<Template> publishTemplateAsync (Template template)

Similar to publishTemplate(Template) but performs the operation asynchronously.

Parameters
template The Remote Config template to be published.
Returns
  • An ApiFuture that completes with a Template when the provided template is published.

public Template rollback (long versionNumber)

Rolls back a project's published Remote Config template to the specified version.

A rollback is equivalent to getting a previously published Remote Config template and re-publishing it using a force update.

Parameters
versionNumber The version number of the Remote Config template to roll back to. The specified version number must be lower than the current version number, and not have been deleted due to staleness. Only the last 300 versions are stored. All versions that correspond to non-active Remote Config templates (that is, all except the template that is being fetched by clients) are also deleted if they are more than 90 days old.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while rolling back the template.

public Template rollback (String versionNumber)

Rolls back a project's published Remote Config template to the specified version.

A rollback is equivalent to getting a previously published Remote Config template and re-publishing it using a force update.

Parameters
versionNumber The version number of the Remote Config template to roll back to. The specified version number must be lower than the current version number, and not have been deleted due to staleness. Only the last 300 versions are stored. All versions that correspond to non-active Remote Config templates (that is, all except the template that is being fetched by clients) are also deleted if they are more than 90 days old.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while rolling back the template.

public ApiFuture<Template> rollbackAsync (String versionNumber)

Similar to rollback(String) but performs the operation asynchronously.

Parameters
versionNumber The version number of the Remote Config template to roll back to.
Returns
  • An ApiFuture that completes with a Template once the rollback operation is successful.

public ApiFuture<Template> rollbackAsync (long versionNumber)

Similar to rollback(long) but performs the operation asynchronously.

Parameters
versionNumber The version number of the Remote Config template to roll back to.
Returns
  • An ApiFuture that completes with a Template once the rollback operation is successful.

public Template validateTemplate (Template template)

Validates a Remote Config template.

Parameters
template The Remote Config template to be validated.
Returns
Throws
FirebaseRemoteConfigException If an error occurs while validating the template.

public ApiFuture<Template> validateTemplateAsync (Template template)

Similar to validateTemplate(Template) but performs the operation asynchronously.

Parameters
template The Remote Config template to be validated.
Returns
  • An ApiFuture that completes with a Template when the provided template is validated.