0

我只是像铁裤一样制作游戏,我试图在游戏结束时放置插页式广告。

但插页式广告总是显示在游戏中间。我认为这对用户来说会很烦人。我担心如果谷歌会禁止我的 admob 帐户。

插页式广告仅在 5 次游戏结束后显示。

我只有一个屏幕 MainGameView.java

这是游戏结束时显示 admob 插页式广告的代码

初始化插页式广告的方法

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialiseAccelerometer();

    // Create the interstitial
    interstitial = new InterstitialAd(this, getResources().getString(R.string.InterstitialAd_unit_id));

}

public void openAd() {
    runOnUiThread(new Runnable() {
        public void run() {
            // Create ad request
            AdRequest adRequest = new AdRequest();

            // Begin loading your interstitial
            interstitial.loadAd(adRequest);

            // Set Ad Listener to use the callbacks below
            interstitial.setAdListener(new AdListener() {

                @Override
                public void onReceiveAd(Ad arg0) {
                    if (interstitial.isReady()) {
                        interstitial.show();
                    }
                }

                @Override
                public void onPresentScreen(Ad arg0) {
                }

                @Override
                public void onLeaveApplication(Ad arg0) {
                }

                @Override
                public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
                }

                @Override
                public void onDismissScreen(Ad arg0) {
                }
            });
        }
    });
}

我在游戏结束时调用 openAd() 方法

public synchronized void GameOver() {
    if (adounter >= this.getResources().getInteger(R.integer.add_shows_every_X_gameovers)) {
        openAd();
        adounter = 0;
    }
    adounter++;
}

非常感谢你,对不起我的英语不好。

4

2 回答 2

1

您的问题是您在收到后立即显示插页式 d(即在 AdListener#onReceiveAd 中)。要这样做。它提供了糟糕的用户体验,并确保您获得低评级。

而是在您的应用程序的自然中断处显示您的添加。

于 2014-03-05T03:41:00.623 回答
0

而是在您的应用程序的自然中断处显示您的添加。

确切地说,更准确地说,如果您执行以下操作将是良好的用户体验: - 在 onCreate 中请求广告 - 在 GameOver 调用中:

if (interstitial.isReady()) {
    interstitial.show();
}
于 2015-09-04T09:34:48.847 回答