【发布时间】:2018-06-04 14:27:17
【问题描述】:
这是我的代码:
final FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
config.setConfigSettings(configSettings);
config.fetch(0).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
// After config data is successfully fetched, it must be activated before newly fetched
// values are returned.
config.activateFetched();
final String playStoreVersionCode = FirebaseRemoteConfig.getInstance().getString(
"android_latest_version_code");
} else {
Utils.appendLog("playStoreVersionCode Error fetching latest params ", "E", Constants.TIMELINE);
}
}
});
现在我想增加我的参数,我看到从 3 月开始有一个 REST API 来更新参数:
https://firebase.google.com/docs/remote-config/api-overview https://firebase.google.com/docs/remote-config/use-config-rest
但我不太了解教程。 为什么我需要使用 curl?这真的像在 use-config-rest 链接中那样有必要吗?
curl --compressed -D headers -H "Authorization: Bearer token" -X GET https://firebaseremoteconfig.googleapis.com/v1/projects/my-project-id/remoteConfig -o filename
快速入门只是展示了一个关于如何获取数据的示例,而不是更改它: https://github.com/firebase/quickstart-android/blob/master/config/app/src/main/java/com/google/samples/quickstart/config/MainActivity.java
【问题讨论】:
标签: android rest firebase firebase-remote-config