0
I wanted to close my Interstitial ad after 30 seconds in case the user doesn’t close manually. I tried to close by simulating the back button pressed, but it has no effect.
public void onFinish() {
Log.d(TAG, "terminou timer pausa 30s");
dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));
//rodarvideo();
}
Is it possible to close programmatically? If yes, how do I do?
Which AD are you generating? There’s nothing in their documentation?
– PauloHDSousa
I’m using the same admob, searched and has nothing to quote about closing.
– Igor Oliveira
I searched and found this same code you’re using, where you call this line of code?
– PauloHDSousa
There is no native way to close the interstitial programmatically, at least according to official documentation. The most you will achieve is through these "hacks" to simulate the "back" button (which even you have tried), but there are no guarantees that will always work.
– Márcio Oliveira
@Paulo no Finish no countdowntimer
– Igor Oliveira
@Márciooliveira can’t simulate a click on the close button?
– Igor Oliveira
The problem is that you do not control the content of the ad’s. Some have close button (which appear in various positions), others a timer, etc. And I believe that the philosophy of ad is to make the user interact with it, so make the app itself close the ad goes against it.
– Márcio Oliveira
I get it. I’ll explain it to the client
– Igor Oliveira