I'm currently developing an app with AdMob's interstitial ads. I'm trying to destroy the ad, but it doesn't appear to work.
I've tried doing that with mInterstitialAd.destroy();
It doesn't work with the error Cannot resolve method 'destroy'
.
I'm currently developing an app with AdMob's interstitial ads. I'm trying to destroy the ad, but it doesn't appear to work.
I've tried doing that with mInterstitialAd.destroy();
It doesn't work with the error Cannot resolve method 'destroy'
.
To wait a millisecond before closing the ad, try this:
Runnable r = new Runnable() {
@Override
public void run() {
MainActivity mainActivity = new MainActivity();
mainActivity.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));
}
};
Handler h = new Handler();
h.postDelayed(r, 1);
The runnable is executed, or run, after 1 millisecond. When it is run, it programatically triggers the back button to close the ad.