javascriptiosfirebasecapacitorfirebase-remote-config

Firebase Remote Config only shows correct value on second App launch


I am using Firebase Remote config in a capacitor.js App using @capacitor-firebase/remote-config firebase plugin. I have the parameter set for first_open and the conditions are true if the first_open is after a set date and false if before the date. Default is set to false.

important part to the code is:

async function initializeSubscribe() {
  try {
     await Capacitor.Plugins.FirebaseRemoteConfig.fetchConfig({
       minimumFetchIntervalInSeconds: 0,
     });

    Capacitor.Plugins.FirebaseRemoteConfig.activate()
 .then(async () => {                     
    const data = await Capacitor.Plugins.FirebaseRemoteConfig.getBoolean({
            key: "first_user",
          });

          const user = data.value;
          console.log("first_user:", user);
          handleRemoteConfig(user, isDateValid);
      
      })
      .catch((err) => {
        console.error(err);
      });
  } catch (err) {
    console.error(err);
  }
}

I've tried adding settimeout as a possible solution but I can't get it to retrieve the value the first time.

This happens only in iOS, Android has no issue with it. Any help would be appreciated.


Solution

  • This issue was recently resolved and will be published with the next release. You can install the dev version:

    npm i @capacitor-firebase/remote-config@1.4.0-dev.5d562ff.1681878046