Follow

Advanced Usage - Adding Banner Callbacks

View original article on our GitHub

If you implemented the banner via the Activity Layout XML, obtain the banner's view (usingfindViewById(), for example) and pass an implementation of a BannerListener to itssetBannerListener() method. The BannerListener must implement the following methods:

@Override
public void onReceiveAd(View banner) {
}
@Override
public void onFailedToReceiveAd(View banner) {
}
@Override
public void onClick(View banner) {
}

If you implemented the banner programmatically, simply pass an implementation of aBannerListener to the banner's constructor:

Banner startAppBanner = new Banner(context, new BannerListener() {
    @Override
    public void onReceiveAd(View banner) {
    }
    @Override
    public void onFailedToReceiveAd(View banner) {
    }
    @Override
    public void onClick(View banner) {
    }
});

IMPORTANT: Do not call loadAd() from within onFailedToReceiveAd(). The SDK will automatically try to reload an ad upon a failure.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments