Radhika Padiyar
Radhika Padiyar

Reputation: 351

react-native firebase remote config

if (__DEV__) {
        firebase.config().enableDeveloperMode();
    }


    firebase
        .config()
        .fetch()
        .then(() => firebase.config().activateFetched())
        .then(() => {
            // Chain additional firebase config methods if needed
            console.log("activated ");
            firebase
                .config()
                .getValue("holiday_promo")
                .then(data => {
                    console.log(data, "data");
                });
        })
        .catch(error => console.log(`Error processing config: ${error}`));

In my firebase remote config I have a parameter as follows : holiday_promo(parameter_key) and value is "promo string" . But when I console the data, it is empty. And get something like this : {source: "remote" val: ƒ val() arguments: null caller: null length: 0 name: "val" } Can someone tell me what is wrong..

Upvotes: 1

Views: 6716

Answers (2)

Yogesh Lolusare
Yogesh Lolusare

Reputation: 2212

firebase
  .config()
  .fetch(0) ...

Remote config is cached for 12 hours by default, and enableDeveloperMode doesn't bypass cache, it just allows for more frequent refreshes of it.

Upvotes: 1

Brayan Salazar
Brayan Salazar

Reputation: 334

you must call the function val() to get data.

firebase
.config()
.getValue("holiday_promo")
.then(data => {
    console.log("data => ", data.val());
});

Upvotes: 4

Related Questions