RemoteConfig class Stay organized with collections Save and categorize content based on your preferences.
The FirebaseRemoteConfig service interface.
Signature:
exportdeclareclassRemoteConfigProperties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| app | App |
Methods
| Method | Modifiers | Description |
|---|---|---|
| createTemplateFromJSON(json) | Creates and returns a new Remote Config template from a JSON string. | |
| getServerTemplate(options) | InstantiatesServerTemplate and then fetches and caches the latest template version of the project. | |
| getTemplate() | Gets the current active version of theRemoteConfigTemplate of the project. | |
| getTemplateAtVersion(versionNumber) | Gets the requested version of theRemoteConfigTemplate of the project. | |
| initServerTemplate(options) | Synchronously instantiatesServerTemplate. | |
| listVersions(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. All versions that correspond to non-active Remote Config templates (i.e., all except the template that is being fetched by clients) are also deleted if they are older than 90 days. | |
| publishTemplate(template, options) | Publishes a Remote Config template. | |
| rollback(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. | |
| validateTemplate(template) | Validates aRemoteConfigTemplate. |
RemoteConfig.app
Signature:
readonlyapp:App;RemoteConfig.createTemplateFromJSON()
Creates and returns a new Remote Config template from a JSON string.
Signature:
createTemplateFromJSON(json:string):RemoteConfigTemplate;Parameters
| Parameter | Type | Description |
|---|---|---|
| json | string | The JSON string to populate a Remote Config template. |
Returns:
A new template instance.
RemoteConfig.getServerTemplate()
InstantiatesServerTemplate and then fetches and caches the latest template version of the project.
Signature:
getServerTemplate(options?:GetServerTemplateOptions):Promise<ServerTemplate>;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | GetServerTemplateOptions |
Returns:
Promise<ServerTemplate>
RemoteConfig.getTemplate()
Gets the current active version of theRemoteConfigTemplate of the project.
Signature:
getTemplate():Promise<RemoteConfigTemplate>;Returns:
Promise<RemoteConfigTemplate>
A promise that fulfills with aRemoteConfigTemplate.
RemoteConfig.getTemplateAtVersion()
Gets the requested version of theRemoteConfigTemplate of the project.
Signature:
getTemplateAtVersion(versionNumber:number|string):Promise<RemoteConfigTemplate>;Parameters
| Parameter | Type | Description |
|---|---|---|
| versionNumber | number | string | Version number of the Remote Config template to look up. |
Returns:
Promise<RemoteConfigTemplate>
A promise that fulfills with aRemoteConfigTemplate.
RemoteConfig.initServerTemplate()
Synchronously instantiatesServerTemplate.
Signature:
initServerTemplate(options?:InitServerTemplateOptions):ServerTemplate;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | InitServerTemplateOptions |
Returns:
RemoteConfig.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. All versions that correspond to non-active Remote Config templates (i.e., all except the template that is being fetched by clients) are also deleted if they are older than 90 days.
Signature:
listVersions(options?:ListVersionsOptions):Promise<ListVersionsResult>;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | ListVersionsOptions | Optional options object for getting a list of versions. |
Returns:
Promise<ListVersionsResult>
A promise that fulfills with aListVersionsResult.
RemoteConfig.publishTemplate()
Publishes a Remote Config template.
Signature:
publishTemplate(template:RemoteConfigTemplate,options?:{force:boolean;}):Promise<RemoteConfigTemplate>;Parameters
| Parameter | Type | Description |
|---|---|---|
| template | RemoteConfigTemplate | The Remote Config template to be published. |
| options | { force: boolean; } | Optional options object when publishing a Remote Config template: -force: Setting this totrue forces the Remote Config template to be updated and circumvent the ETag. 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. SeeETag usage and forced updates. |
Returns:
Promise<RemoteConfigTemplate>
A Promise that fulfills with the publishedRemoteConfigTemplate.
RemoteConfig.rollback()
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.
Signature:
rollback(versionNumber:number|string):Promise<RemoteConfigTemplate>;Parameters
| Parameter | Type | Description |
|---|---|---|
| versionNumber | number | string | 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:
Promise<RemoteConfigTemplate>
A promise that fulfills with the publishedRemoteConfigTemplate.
RemoteConfig.validateTemplate()
Validates aRemoteConfigTemplate.
Signature:
validateTemplate(template:RemoteConfigTemplate):Promise<RemoteConfigTemplate>;Parameters
| Parameter | Type | Description |
|---|---|---|
| template | RemoteConfigTemplate | The Remote Config template to be validated. |
Returns:
Promise<RemoteConfigTemplate>
A promise that fulfills with the validatedRemoteConfigTemplate.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-16 UTC.