0

I just made game like ironpants, I'm trying to put interstitial ads when the game over.

but the interstitial ads always show in the middle of the game. I think it'll be annoying for users. and I'm afraid if Google will banned my admob account.

The interstitial ads only show after 5x game over.

I only have onescreen MainGameView.java

here's the code to show admob interstitial ads when the game was over

the methods to initialize the interstitial ads

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

and I call openAd() method when the game was over

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

thank you very much and sorry for my bad English.

taylorSWIFT
  • 39
  • 1
  • 4

2 Answers2

1

Your problem is that you are showing the interstitial d as soon as it is received (ie in AdListener#onReceiveAd). Don't do this. It provides a poor user experience and will ensure you get low ratings.

Instead show your add at a natural break in your app.

William
  • 20,150
  • 8
  • 49
  • 91
0

Instead show your add at a natural break in your app.

Exactly, to be more precise it would be good user experience if you do the following: - request for the ad in onCreate - in GameOver call:

if (interstitial.isReady()) {
    interstitial.show();
}