Search code examples
androidadmobandengineinterstitial

Admob InterstitialAd loading in Andengine GLES2


I am trying to add full screen ad using admob in my game; created in andengine gles2.
When I call this function:

if (mInterstitialAd.isLoaded()) {
        mInterstitialAd.show();
    }

The screen start flickering with only first texture loaded in "onCreateResources" function.
Here is my initialization code:

 @Override
 protected void onSetContentView() {
    this.mRenderSurfaceView = new RenderSurfaceView(this);
    this.mRenderSurfaceView.setRenderer(this.mEngine, this);

    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("MY_INTERSTITIAL_CODE");

    AdRequest adRequest = new AdRequest.Builder().build();
    mInterstitialAd.loadAd(adRequest);
    this.setContentView(mRenderSurfaceView);

 }

Am I doing anything wrong?
Any help is appreciated.
Thanks


Solution

  • Instead of using "SimpleBaseGameActivity", I used "LayoutGameActivity" which resolved my problem.