【发布时间】:2017-03-16 13:56:07
【问题描述】:
我在启动时覆盖了我的 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。
我想得到的是应用程序设置的区域fr_FR的test_property。
我在应用程序中更改区域后尝试FirebaseApp.initializeApp(...),但 Firebase 似乎从其他地方获取该区域。
是否有人知道以编程方式设置/覆盖区域的方法,以便 firebase 将该区域用于区域条件?
我不想使用 Firebase Analytics User Properties,因为它们更新得太晚了。
【问题讨论】:
-
>> “我不想使用 Firebase Analytics 用户属性,因为它们更新得太晚了。”你真的试过了吗? IIRC 分析用户属性应立即生效,以便解决 Firebase 远程配置条件。只要确保从服务器而不是应用本地缓存中获取新的配置。
-
你找到解决方案来覆盖这个值了吗?
标签: android firebase firebase-remote-config