Hi,
I have implemented interstitial ads in my apps for a long time, but now I have noticed strange behavior when I receive interstitial with video content.
When I receive interstitial with video and I click close button or back button it takes about 2-3 seconds to "onCloseAd" function being called. With this behavior the same screen is shown for a few seconds after de interstitial close, and this violates the Admob policies.
With text and image interstitial this doesn't happen.
Here a code snippet:
public void initInterstitial() {interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("");
// Create ad request.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
super.onAdClosed();
showNextScreen();
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
//Try again
initInterstitial();
}
});
}
private void showInterstitial () {
if(interstitial.isLoaded()) {
interstitial.show();
} else {
showNextScreen();
}
}
App Info:
Google Play Services = 11.8.0
Android target SKD version = 26
Android device info:
Nexus 6P
Android 8.1.0
Google Play Services: 11.9.51
Thanks,
Marta