0
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 some problem to be using the same Adrequest that I use for the banner, but the banner keeps working. (in this and the other Activity as well)
The application does not accuse any error, so it gets harder to detect which cause does not work
Site where I picked up information to place interticial ad => https://developers.google.com/admob/android/interstitial
EDIT 01 ----------------------------------
I did what I was told, 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 (we could not transcribe, so the image):
There is a tutorial perfectly explained on the Admob website.
– Márcio Oliveira
@Márciooliveira could give me the link?
– Boneco Sinforoso
https://developers.google.com/admob/android/interstitial
– Márcio Oliveira