[英]Firebase Remote Config: How to Change Value Parameters
I am using Firebase Remote Config and want to change the value of a boolean parameter when I press on the button.我正在使用 Firebase 远程配置并希望在按下按钮时更改 boolean 参数的值。
I tried this but it is not working:我试过这个,但它不工作:
btntry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myconfiguration.getBoolean("btn_enable") = true;
}
});
and it gives me this error:它给了我这个错误:
error: unexpected type
myconfiguration.getBoolean("btn_enable") = state;
^
required: variable
found: value
Can someone help me setting the value of "btn_enable" to true?有人可以帮我将“btn_enable”的值设置为 true 吗?
You can't modify the values that are fetched from Firebase Remote Config in the client.您无法修改从客户端中的 Firebase 远程配置中获取的值。 The only ways to change those is through the Firebase console, or through the REST API/Admin SDKs, which are designed to only be used on a server.
改变这些的唯一方法是通过 Firebase 控制台,或通过 REST API/Admin SDK,它们被设计为仅在服务器上使用。
But if you want to override a value from Remote Config in your app, you can just store the value that you get in a variable and then override that with your custom value.但是,如果您想在应用程序中覆盖远程配置中的值,您可以将获得的值存储在变量中,然后用您的自定义值覆盖它。
So:所以:
bool myValue = myconfiguration.getBoolean("btn_enable");
And then later:然后后来:
myValue = state;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.