How do I get the intertitial announcement between one activity and another?

1

I think I did everything correctly, but the application jumps to the next activity without appearing anything.

public class...

  private FirebaseAnalytics mFirebaseAnalytics;
  private AdView adView01;
  private AdRequest adRequest01;
  private InterstitialAd adInter01;

  onCreate()...

    MobileAds.initialize(this, "ca-app-pub-6843243039127549/2394454715");
    adView01=(AdView)findViewById(R.id.adView03);
    adRequest01=new AdRequest.Builder().build();
    adView01.loadAd(adRequest01);
    adInter01=new InterstitialAd(this);
    adInter01.setAdUnitId("ca-app-pub-6843243039127549/3871187910");
    adInter01.loadAd(adRequest01);

    mFirebaseAnalytics=FirebaseAnalytics.getInstance(this);

  onClick()...

    case R.id.btnCompras:

      adInter01.show();
      Intent it01 = new Intent(this, MainActivity02.class);
      startActivity(it01);
      break;

I think it may be a problem because I'm using the same AdRequest I use for the banner, but the banner keeps running. (this and other activity too)

Theapplicationdoesnotacknowledgeanyerrors,soitbecomesmoredifficulttodetectthecauseofnon-operation

SitewhereIgotinformationtoplaceaninterticialad=> link

EDIT 01 ----------------------------------

I've done what you indicated, see the code below:

case R.id.btnCompras:

  adInter01.setAdListener(new AdListener(){
    @Override
    public void onAdClosed(){
      Intent it01 = new Intent(this, MainActivity02.class);
      startActivity(it01);
    }
  });
  break;

But the attempt to implement the code, presented an error (could not transcribe, so the image):

    
asked by anonymous 27.08.2017 / 01:08

1 answer

0

I believe you should call the new activity when the ad is closed, using AdListener

mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLeftApplication() {
            // Code to be executed when the user has left the app.

        }

        @Override
        public void onAdClosed() {
            // Code to be executed when when the interstitial ad is closed.
            //aqui tu chama a nova activity
    });
    
27.08.2017 / 02:28