2016-04-03 138 views
0

我目前在我的應用程序PlayScreen中使用Appodeal SDK顯示橫幅廣告。在onCreate()方法看起來像這樣libGDX Appodeal橫幅廣告顯示

@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); 

問題顯示:

在應用程序啓動時,橫幅在PlayScree中正確顯示並在菜單屏幕中隱藏。但是,當我退出應用程序Gdx.app.exit按主頁按鈕並重新啓動它,在PlayScreen中不顯示橫幅。 Appodeal記錄在這兩種情況下

[..] D/Appodeal: Showing Banner (debugType: banner_320, isLoaded: true, isLoading: false) 
    [..] D/Appodeal: Mraid onBannerShown 

我最好的猜測是同樣的思路,它具有與GdxAppodeal.getInstance()(Singletone)當應用程序仍然在後臺繼續運行不重新做。每當這個實例剛剛創建時,橫幅就會顯示出來。

回答

0

因爲我用的是appodeal SDK通過我的兩個libGDX核心項目和我的Android項目實現的接口,我能夠通過改變GdxAppodeal.getInstance()Appodeal來獲得期望的結果

因此,例如:

GdxAppodeal.getInstance().initialize("myappkey", GdxAppodeal.BANNER); 

成爲

Appodeal.initialize(this, "myappkey", GdxAppodeal.BANNER);