即使我已将isDeveloperModeEnabled
设置为true,我也无法在每秒内刷新远程配置值。这是每秒刷新缓存的代码,我想立即刷新它,因为测试目的:
firebaseRemoteConfig.fetch(1)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
Log.d(TAG, "remote config is fetched.")
firebaseRemoteConfig.activateFetched()
}
}
在这里我设置了开发者模式,因为它是真的:
val remoteConfig = FirebaseRemoteConfig.getInstance()
val configSettings = FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build()
remoteConfig.setConfigSettings(configSettings)
问题仍然是我无法刷新远程配置值,即使我已经设置开发者模式变为真?我应该等12个小时来测试吗?
答案 0 :(得分:0)
检查一下,看看缓存在1小时后过期,根据需要修改
private void fetch() {
//loaded defaults..
String result = mFirebaseRemoteConfig.getString(VERSION_CODE);
Log.d(TAG, " remote default value before fetching : VERSION_CODE : " + result);
long cacheExpiration = 3600;
if (mFirebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mFirebaseRemoteConfig.fetch(cacheExpiration)
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.e(TAG, "Fetch Succeeded");
mFirebaseRemoteConfig.activateFetched();
} else {
Log.e(TAG, "Fetch Failed");
}
handlerResultRemoteConfig();
}
});
}