I override the Locale of my Android App at startup and allow to change the region at runtime. I'm settings the Locale like this:
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);
Now i want to use Firebase-Remote-Config with a Region/Country Condition. e.g.
test_property -> fr_FR = Bonjour
-> de_DE = Hallo
-> default = Hi
If i now have my Device set to de_DE and my app set to fr_FR i will get the test_property from the de_DE region (Hallo).
What i want to get is the test_property for the region fr_FR set by the app.
I tried to FirebaseApp.initializeApp(...) after changing the region in the app, but Firebase seems to get the region from somewhere else.
Does someone know a way to set/override the region programmatically so firebase will use that region for the region condition?
I don't want to use Firebase Analytics User Properties, as they get updated way too late.
In your Firebase Console:
a) Set a user property for locale. Go to
Analyticsmenu and selectUSER PROPERTIEStab.user_locale.b) Set a condition for remote configs. Go to
Remote Configmenu and selectCONDITIONStab.user_locale.FOR TEXT-exactly matches.defor German.translation_defor condition and select a color.c) For every remote config parameter add value for condition.
translation_de.On locale change in your code set User Property