startAD mobi 拒绝了我的申请,原因如下: StartAD.mobi 横幅必须以与应用程序本地化相同的语言显示(在俄文版应用程序中,横幅必须是俄文,在英文版应用程序中,分别用英语)。在您的应用程序中,当本地化为英语时,会显示俄语横幅。
现在代码如下所示:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// мой id
this.sadView = new SADView(this, "99999999999999999999999");
LinearLayout layout = (LinearLayout)findViewById(R.id.myleaner);
layout.addView(this.sadView);
this.sadView.loadAd(SADView.LANGUAGE_RU);
问题:如何将广告横幅绑定到应用本地化?
实施建议的方法后:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// мой id
this.sadView = new SADView(this, "99999999999999999999");
LinearLayout layout = (LinearLayout) findViewById(R.id.myleaner);
layout.addView(this.sadView);
//this.sadView.loadAd(SADView.LANGUAGE_RU);
public static Locale getSystemLocale(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Resources.getSystem().getConfiguration().getLocales().get(0);
} else {
return Resources.getSystem().getConfiguration().locale;
}
}
switch (getSystemLocale().getLanguage()) {
case "ru":
sadView.loadAd(SADView.LANGUAGE_RU);
break;
case "en":
sadView.loadAd(SADView.LANGUAGE_EN);
break;
}
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// мой id
this.sadView = new SADView(this, "59e49c13e229e670008b4569");
LinearLayout layout = (LinearLayout) findViewById(R.id.myleaner);
layout.addView(this.sadView);
public static Locale getSystemLocale(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Resources.getSystem().getConfiguration().getLocales().get(0);
} else {
return Resources.getSystem().getConfiguration().locale;
}
}
}
switch (getSystemLocale().getLanguage()) {
case "ru":
sadView.loadAd(SADView.LANGUAGE_RU);
break;
case "en":
sadView.loadAd(SADView.LANGUAGE_EN);
break;
}
您可以获得当前的语言环境:
然后从中旋转:
如果应用程序语言环境依赖于系统语言环境,这一切都会奏效。