我在启动时重写了Android应用程序的区域设置,并允许在运行时更改区域。我把现场设置成这样:
Resources res = context.getResources();
Configuration configuration = res.getConfiguration();
DisplayMetrics metrics = res.getDisplayMetrics();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration.setLocale(locale);
}else{
configuration.locale = locale;
}
Locale.setDefault(locale);
res.updateConfiguration(configuration, metrics);现在,我想使用具有区域/国家条件的Firebase-Remote-Config。例如:
test_property -> fr_FR = Bonjour
-> de_DE = Hallo
-> default = Hi如果我现在将我的设备设置为de_DE,我的应用程序设置为fr_FR,我将从de_DE区域(Hallo)获得test_property。我想得到的是应用程序设置的区域test_property fr_FR。
在更改应用程序中的区域后,我尝试使用FirebaseApp.initializeApp(...),但是Firebase似乎从其他地方获得了该区域。
是否有人知道如何以编程方式设置/重写该区域,以便防火墙将该区域用于区域条件?
我不想使用Firebase User Properties,因为它们更新得太晚了。
发布于 2017-03-16 05:56:07
在Firebase控制台中
设置区域设置的用户属性。转到Analytics菜单并选择USER PROPERTIES选项卡。
user_locale。( b)为远程倾诉设定条件。转到Remote Config菜单并选择CONDITIONS选项卡。
user_locale。FOR TEXT - exactly matches.de。translation_de )作为条件并选择颜色。( c)对每个远程配置参数添加条件值。
translation_de。关于代码集用户属性中的区域设置更改
FirebaseAnalytics.getInstance(getContext())
.setUserProperty("user_locale", "de");
FirebaseRemoteConfig.getInstance()
.fetch(1)
.addOnCompleteListener(activity, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
FirebaseRemoteConfig.getInstance().activateFetched();
}
}
});https://stackoverflow.com/questions/41265757
复制相似问题