Firebase Remote Config does not work in React Native

Viewed 54

No matter what I try, it seems like it is not possible to fetch values from the console with firebase remote config.

I am, "connected" but no values are being fetched besides the default values I have set.

I am using react-native-firebase (v6) https://rnfirebase.io/remote-config/usage

//Package JSON
"react-native": "0.66.0",
"@react-native-firebase/app": "^14.11.1",
"@react-native-firebase/remote-config": "^14.11.1",

Here is my code which is executed on app load:

  async componentDidMount() {
    const appVersion = DeviceInfo.getVersion();

    await remoteConfig().setConfigSettings({
      minimumFetchIntervalMillis: 30000,
    });

    await remoteConfig()
      .setDefaults({
        is_application_on: true,
        min_app_version: appVersion
      })
      .then(() => remoteConfig().fetchAndActivate())
      .then((fetchedRemotely) => {});

      let isAppOn = remoteConfig().getBoolean('is_application_on');
      let appMinVersion = remoteConfig().getNumber('min_app_version');

      this.setState({
        isAppOn: isAppOn ? true : false
      }, () => {
        alert(this.state.isAppOn)
        alert(appMinVersion)
      })
}

My firebase is connected but remote config is the only module I cannot seem to connect to...

Cheers.

0 Answers
Related