你可以使用`.setMinimumFetchIntervalInSeconds(43200)`这样的方式发布我的应用吗?

huangapple go评论84阅读模式
英文:

Can i release my app with .setMinimumFetchIntervalInSeconds(43200) like this?

问题

I read on firebase the fetch interval should be 12 hours when releasing the app, so I put 43200 seconds on .setMinimumFetchIntervalInSeconds(43200) that translates to 12 hours. Should I release my app like this? Am I doing something wrong? am I missing something?

我在 Firebase 上阅读到,在发布应用时,获取间隔应为 12 小时,因此我将 43200 秒放在 .setMinimumFetchIntervalInSeconds(43200) 上,这相当于 12 小时。我应该这样发布我的应用吗?我有做错什么吗?我漏掉了什么吗?

here is my firebase remote config code:

这是我的 Firebase 远程配置代码:

//firebase remote configuration
// default value
firebaseDefaultMap = new HashMap<>();
firebaseDefaultMap.put(SET_MAX_PROGRESS, 10000);
mFirebaseRemoteConfig.setDefaults(firebaseDefaultMap);

//debug mode ON !!I SHOULD TURN IT FO BEFORE RELEASE!!
/* mFirebaseRemoteConfig.setConfigSettings(
new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG)
.build());*/

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

progress = view.findViewById(R.id.progress);
target_users = view.findViewById(R.id.target_users);
//Fetch listener
mFirebaseRemoteConfig.fetch().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
mFirebaseRemoteConfig.activateFetched();
Log.d(TAG, "Fetched value: " + mFirebaseRemoteConfig.getString(SET_MAX_PROGRESS));
}else{
}
Log.d(TAG, "Default value: " + mFirebaseRemoteConfig.getString(SET_MAX_PROGRESS));
}
});
int max = (int) mFirebaseRemoteConfig.getDouble(SET_MAX_PROGRESS);
target_users.setText("Target: "+ max);
progress.setMax(max);
//end firebase remote configuration

英文:

I read on firebase the fetch interval should be 12 hours when releasing the app, so I put 43200 seconds on .setMinimumFetchIntervalInSeconds(43200) that translates to 12 hours. Should I release my app like this? Am I doing something wrong? am I missing something?

here is my firebase remote config code:

 //firebase remote configuration
    // default value
    firebaseDefaultMap = new HashMap&lt;&gt;();
    firebaseDefaultMap.put(SET_MAX_PROGRESS, 10000);
    mFirebaseRemoteConfig.setDefaults(firebaseDefaultMap);

    //debug mode ON !!I SHOULD TURN IT FO BEFORE RELEASE!!
   /* mFirebaseRemoteConfig.setConfigSettings(
            new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG)
                    .build());*/

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

    progress = view.findViewById(R.id.progress);
    target_users = view.findViewById(R.id.target_users);
    //Fetch listener
    mFirebaseRemoteConfig.fetch().addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
        @Override
        public void onComplete(@NonNull Task&lt;Void&gt; task) {
            if (task.isSuccessful()) {
                mFirebaseRemoteConfig.activateFetched();
                Log.d(TAG, &quot;Fetched value: &quot; + mFirebaseRemoteConfig.getString(SET_MAX_PROGRESS));
            }else{
            }
            Log.d(TAG, &quot;Default value: &quot; + mFirebaseRemoteConfig.getString(SET_MAX_PROGRESS));
        }
    });
    int max = (int) mFirebaseRemoteConfig.getDouble(SET_MAX_PROGRESS);
    target_users.setText(&quot;Target: &quot;+ max);
    progress.setMax(max);
    //end firebase remote configuration

答案1

得分: 0

Yeah, 你可以以43200秒的间隔发布你的应用,甚至建议这样做。想象一下下一个情景:

你的应用有10000个用户,你对firebase进行了更改,但你的间隔为0,例如。这意味着立即所有连接的用户都将访问firebase并检索新的值,显然这不是好事。这个间隔是为了减轻服务器的压力而创建的。

另外,如果我没有记错的话,如果你删除这一行:

.setMinimumFetchIntervalInSeconds(43200)

它不会有任何影响,因为这是默认值。
祝好!

英文:

cant comment yet so posting it as an answer.
Yeah you can publish your app with the 43200 seconds interval and its even recommended. think of the next senario:

Your app has 10000 users and you make a change to your firebase but your interval is 0 for exmaple. that means that immediately all the connected users will reach the firebase and retrieve the new values, thats obviously not good. the interval is created in order to reduce stress on the servers.

Also if I'm not wrong if you remove this line:

.setMinimumFetchIntervalInSeconds(43200)

It wont make any difference because its a default value.
Cheers

huangapple
  • 本文由 发表于 2020年8月13日 19:28:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/63394179.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定