目前,我正在应用程序PlayScreen中显示一个带有Appodeal的横幅广告。onCreate()方法如下所示
@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);
} onResume()如下所示
@Override
protected void onResume(){
super.onResume();
Appodeal.onResume(this, Appodeal.BANNER);
}而横幅则通过
GdxAppodeal.getInstance().show(GdxAppodeal.BANNER_BOTTOM);问题:
在app启动时,横幅在PlayScreen中正确显示,在MenuScreen中隐藏。但是当我退出带有Gdx.app.exit 或的应用程序时,按“主页”按钮并重新启动它时,PlayScreen中不会显示任何横幅。Appodeal在两种情况下都记录相同的行。
[..] D/Appodeal: Showing Banner (debugType: banner_320, isLoaded: true, isLoading: false)
[..] D/Appodeal: Mraid onBannerShown我的最佳猜测是,当应用程序在后台仍然处于活动状态时,它与GdxAppodeal.getInstance() (Singletone)没有重新创建有关。每次新创建此实例时,横幅都会显示。
发布于 2016-04-03 15:33:14
因为我是通过我的libGDX核心项目和我的Android项目实现的接口使用appodeal的,所以我能够通过将 both GdxAppodeal.getInstance()更改为GdxAppodeal.getInstance()来获得所需的结果。
例如:
GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER);变成了
Appodeal.initialize(this, "myappkey", GdxAppodeal.BANNER);https://stackoverflow.com/questions/36386937
复制相似问题