Android libGDX Appodel横幅广告显示
我目前正在使用Appodel SDK在我的应用程序播放屏幕上显示横幅广告。onCreate()方法如下所示Android libGDX Appodel横幅广告显示,android,sdk,libgdx,banner,adbannerview,Android,Sdk,Libgdx,Banner,Adbannerview,我目前正在使用Appodel SDK在我的应用程序播放屏幕上显示横幅广告。onCreate()方法如下所示 @Override protected void onCreate (Bundle savedInstanceState) { ... View gameView = initializeForView(new MyGame(this, this, this), config); GdxAppodeal.getInstan
@Override
protected void onCreate (Bundle savedInstanceState) {
...
View gameView = initializeForView(new MyGame(this, this, this), config);
GdxAppodeal.getInstance().disableLocationPermissionCheck();
GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER);
GdxAppodeal.getInstance().setTesting(true);
GdxAppodeal.getInstance().setLogging(true);
layout.addView(gameView);
setContentView(layout);
}
@Override
protected void onResume(){
super.onResume();
Appodeal.onResume(this, Appodeal.BANNER);
}
onResume()如下所示
@Override
protected void onCreate (Bundle savedInstanceState) {
...
View gameView = initializeForView(new MyGame(this, this, this), config);
GdxAppodeal.getInstance().disableLocationPermissionCheck();
GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER);
GdxAppodeal.getInstance().setTesting(true);
GdxAppodeal.getInstance().setLogging(true);
layout.addView(gameView);
setContentView(layout);
}
@Override
protected void onResume(){
super.onResume();
Appodeal.onResume(this, Appodeal.BANNER);
}
横幅通过
GdxAppodeal.getInstance().show(GdxAppodeal.BANNER_BOTTOM);
问题:
在应用程序启动时,横幅将正确显示在播放屏幕中,并隐藏在菜单屏幕中。但是当我使用Gdx.app.exit或退出应用程序时,按下home按钮并重新启动它,屏幕上不会显示任何横幅。Appodel在这两种情况下记录相同的行
[..] D/Appodeal: Showing Banner (debugType: banner_320, isLoaded: true, isLoading: false)
[..] D/Appodeal: Mraid onBannerShown
我最好的猜测是,这与GdxAppodeal.getInstance()(Singletone)在应用程序在后台仍处于活动状态时没有被重新创建有关。每次新创建此实例时,横幅都会显示。因为我是通过libGDX核心项目和Android项目都实现的接口使用AppodalSDK的,所以我可以通过将everyGdxAppodeal.getInstance()更改为Appodale来获得所需的结果 例如:
GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER);
变成
Appodeal.initialize(this, "myappkey", GdxAppodeal.BANNER);