簡體   English   中英

libGDX Appodeal標語廣告顯示

[英]libGDX Appodeal Banner Ad Display

我目前正在使用Appodeal SDK在應用程序PlayScreen中顯示橫幅廣告。 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);

問題:

在應用啟動時,橫幅會在PlayScreen中正確顯示,並在MenuScreen中隱藏。 但是,當我使用Gdx.app.exit退出應用程序按home按鈕並重新啟動它時,PlayScreen中沒有顯示橫幅。 在兩種情況下,阿波代爾記錄相同的行

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

我最好的猜測是,它與在后台仍處於活動狀態的應用程序未重新創建GdxAppodeal.getInstance()(Singletone)有關。 每次重新創建該實例時,都會顯示橫幅。

因為我通過libGDX核心項目和Android項目都實現的接口使用了appodeal SDK,所以我能夠通過將每個 GdxAppodeal.getInstance()更改為Appodeal來獲得所需的結果。

因此,例如:

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

成為

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM