when my app is not connected to internet would like the default values to be read from the file downloaded from the firebase console and not the default values specified within the code.
Went through the following documentation - https://firebase.google.com/docs/remote-config/get-started?platform=web#firebase-console_1
Also, this is what the library says -
Also as per the documentation it says
/** * Sets the default values from a resource file. * On iOS this is a plist file and on Android this is an XML defaultsMap file. * *
js * // put in either your iOS or Android directory without the file extension included (.plist or .xml) * await firebase.remoteConfig().setDefaultsFromResource('config_resource'); * * // resource values will now be loaded in with your other config values * const config = firebase.remoteConfig().getAll(); *
* * @param resourceName The plist/xml file name with no extension. */ setDefaultsFromResource(resourceName: string): Promise;
Tried above and nothing works Downloaded the file and kept it somewhere in app. But when i am trying to read the values, it gives error. Following is the code
//this runs there is no network.
if (!!source) {
remoteConfig().setDefaultsFromResource('remote_config_defaults.json');
} else {
await remoteConfig().fetchAndActivate();
}
const config = remoteConfig();
setAppConfig('RemoteKey', 'Code_Default_Value', (key) => config.getString(key));
This is giving the error - saying remote_config_defaults.json does not exist. I tried following as well
const rcDefaults = require('./src/utils/remote_config_defaults.json');
remoteConfig().setDefaultsFromResource =rcDefaults;
now it does not takes in the values of this file but from the default values.
How to make it work? I am working with react native