简体   繁体   中英

Android - Fetching Value from Firebase RemoteConfig

I want to fetch the value only once during the launch of the application. I am setting the the setMinimumFetchIntervalInSeconds = 3600 seconds. I made a change on remoteConfig. But when I build my Application, I can't see that change. Does that mean setMinimumFetchIntervalInSeconds is required to after how long user can see the value once you publish the change on remoteConfig?

FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
        FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                .setMinimumFetchIntervalInSeconds(3600)
                .build();
        mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);

When a user launchs your app for the first time, FirebaseRemoteConfig will try to load the config immediately. The next fetch will be near at the specified minimum interval value. ie 3600 .

By default, FirebaseRemoteConfig fetches the config by 12 hour interval. It is advised that not to throttle it with too many requests, especially if you have many users.

When developping your application you can set minimum fetch interval to 0 to see immediately the published config changes.

Do not forget to fetch and activate your config. https://firebase.google.com/docs/remote-config/get-started?platform=android#firebase-console

Hope, it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM