I'm currently displaying a banner-ad in my applications PlayScreen with the Appodeal SDK. The onCreate() method looks like this
@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);
}
The onResume() looks like this
@Override
protected void onResume(){
super.onResume();
Appodeal.onResume(this, Appodeal.BANNER);
}
And the banner is displayed through
GdxAppodeal.getInstance().show(GdxAppodeal.BANNER_BOTTOM);
Problem:
On app start, the banner is displayed correctly in the PlayScreen and hiden in the MenuScreen. But when i exit the app with Gdx.app.exit or press the home button and restart it, no banner is shown in the PlayScreen. Appodeal logs the same lines in both cases
[..] D/Appodeal: Showing Banner (debugType: banner_320, isLoaded: true, isLoading: false)
[..] D/Appodeal: Mraid onBannerShown
My best guess is, that it has to do with the GdxAppodeal.getInstance() (Singletone) not being recreated when the application is still active in the background. Everytime this instance is freshly created, the banner shows.
Because i was using the appodeal SDK through an interface that both my libGDX core project and my Android project implemented, i was able to get the desired result by changing every GdxAppodeal.getInstance() to Appodeal
So for example:
GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER);
became
Appodeal.initialize(this, "myappkey", GdxAppodeal.BANNER);