Configuration config = getBaseContext().getResources().getConfiguration();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
config.setLocale(mLocale);
} else{
config.locale = mLocale;
}
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());mLocale...
<application
android:name="com.myapp.myapp"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
....
// internal reference a modified Locale private Locale mLocale = null;
@Override public void onCreate() { super.onCreate();
//get device region and language Locale locale = Locale.getDefault(); String lang = locale.getLanguage(); String region = locale.getCountry();
Log.d(TAG, "original country code: " + lang + "-" + region);
//read the available locales String filteredRegion = "DE"; String filteredLanguage = "de";
// .. a bunch of if's here, can't share for privacy reasons...
Configuration config = getBaseContext().getResources().getConfiguration();
if (!config.locale.getLanguage().equals(filteredLanguage) && !config.locale.getCountry().equals(filteredRegion))
{
Log.d(TAG,"forcing "+filteredLanguage+"-"+filteredRegion);
mLocale = new Locale(filteredLanguage, filteredRegion);
Locale.setDefault(mLocale);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
config.setLocale(mLocale);
} else{
config.locale = mLocale;
}
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
--
---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/b1K4Ow59eWY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.
To post to this group, send email to google-adm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vu, Tristian
I duplicated the setup with the Application subclass but you were right that the Locale configuration change was not enough to trigger the problem. Even though removing it solved the problem for me, there might be other factors that also contribute. I have to experiment more to figure out a minimum setup to reproduce this issue.
To unsubscribe from this group and all its topics, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.