Bryan Denny
Bryan Denny

Reputation: 27596

Is it possible to detect wether an AdMob ad was displayed?

For example: let's say an AdMob fails, or more likely, the user is using an AdBlocker to block the ads.

Is there any way to detect this so I can show an in-house ad instead of nothing? The in-house ad would just tell the user to purchase the premium version to remove ads.

Upvotes: 0

Views: 776

Answers (1)

Eric Nordvik
Eric Nordvik

Reputation: 14746

You can add a listener to the AdView:

AdView admob = (The inflated view)
admob.setAdListener(new AdListener() {
  @Override
  public void onReceiveRefreshedAd(AdView arg0) {}

  @Override
  public void onReceiveAd(AdView arg0) {}

  @Override
  public void onFailedToReceiveRefreshedAd(AdView arg0) {}

  @Override
  public void onFailedToReceiveAd(AdView arg0) {}
});

You can then implement the needed steps in the provided callback functions (onFailedToReceive...)

Upvotes: 1

Related Questions