Jump to top

remote-config

interface

The Firebase Remote RemoteConfig service interface.

This module is available for the default app only.

Example

Get the Remote RemoteConfig service for the default app:

const defaultAppRemoteConfig = firebase.remoteConfig();

Properties

app

</>

The current FirebaseApp instance for this Firebase service.

app: FirebaseApp;

fetchTimeMillis

</>

The number of milliseconds since the last Remote RemoteConfig fetch was performed.

fetchTimeMillis: number;

lastFetchStatus

</>

The status of the latest Remote RemoteConfig fetch action.

lastFetchStatus: "success" | "failure" | "no_fetch_yet" | "throttled";

settings

</>

Provides an object which provides the properties minimumFetchIntervalMillis & fetchTimeMillis if they have been set using setConfigSettings({ fetchTimeMillis: number, minimumFetchIntervalMillis: number }). A description of the properties can be found above

settings: { fetchTimeMillis: number, minimumFetchIntervalMillis: number };

Methods

activate

</>

Moves fetched data to the apps active config. Resolves with a boolean value of whether the fetched config was moved successfully.

activate(): Promise<boolean>;

ensureInitialized

</>

Ensures the last activated config are available to the getters.

ensureInitialized(): Promise<void>;

fetch

</>

Fetches the remote config data from Firebase, as defined in the dashboard. If duration is defined (seconds), data will be locally cached for this duration.

fetch(expirationDurationSeconds?: undefined | number): Promise<void>;

fetchAndActivate

</>

Fetches the remote config data from Firebase, as defined in the dashboard.

fetchAndActivate(): Promise<boolean>;

getAll

</>

Returns all available config values.

getAll(): ConfigValues;

getBoolean

</>

Gets a config property using the key and converts to a boolean value

getBoolean(key: string): boolean;

getNumber

</>

Gets a config property using the key and converts to a number value. It will be 0 if the value is not a number.

getNumber(key: string): number;

getString

</>

Gets a config property using the key and converts to a string value

getString(key: string): string;

getValue

</>

Gets a ConfigValue by key.

getValue(key: string): ConfigValue;

reset

</>

Deletes all activated, fetched and defaults configs and resets all Firebase Remote Config settings.

reset(): Promise<void>;

setConfigSettings

</>

Set the Remote RemoteConfig settings, currently able to set fetchTimeMillis & minimumFetchIntervalMillis

setConfigSettings(configSettings: ConfigSettings): Promise<void>;

setDefaults

</>

Sets default values for the app to use when accessing values. Any data fetched and activated will override any default values. Any values in the defaults but not on Firebase will be untouched.

setDefaults(defaults: ConfigDefaults): Promise<null>;

setDefaultsFromResource

</>

Sets the default values from a resource file. On iOS this is a plist file and on Android this is an XML defaultsMap file.

setDefaultsFromResource(resourceName: string): Promise<null>;

Statics

LastFetchStatus

</>

A pseudo-enum for usage with firebase.remoteConfig().lastFetchStatus to determine the last fetch status.

remote-config.LastFetchStatus: LastFetchStatus;

ValueSource

</>

A pseudo-enum for usage with ConfigValue.source to determine the value source.

remote-config.ValueSource: ValueSource;