Amr El Aswar
Amr El Aswar

Reputation: 3525

Get the view of an Admob InterstitialAd

I have Interstitial ads in my app but I would like to implement an OnTouchListener to the view of the InterstitialAd when it appears but there is no direct way of doing so in the InterstitialAd class like there is in AdView for banner ads. So my question is how can I get the view of the Interstitial ad when it appears so I can set an OnTouchListener to it ?

Upvotes: 0

Views: 280

Answers (2)

RedBrogdon
RedBrogdon

Reputation: 5351

AdMob does not provide a means to directly access the view hierarchy for an interstitial ad. This is done intentionally for a number of reasons relating to both policy and design.

As AndroidMechanic pointed out, however, you can use an AdListener to receive events that tell you what's going on with an ad. If you'd like to know when an ad was clicked, for example, you can use onAdLeftApplication, which is called when a user has tapped on an ad, causing a browser or other app to open in response.

Upvotes: 0

Viral Patel
Viral Patel

Reputation: 33438

Admob aleady provides the AdListener interface for this.

You can implement the AdListener interface and then use the public void onAdClosed () method to do whatever you want when the user returns to your app after viewing the ad or clicking on it. Read more in the official documentation

As per the documentation in this link the method is called as follows:

Called when the user is about to return to the application after clicking on an ad.

Upvotes: 2

Related Questions