Skip to content

Advanced integration of Full Screen Overlay Ad

Marius Merkevičius edited this page May 11, 2015 · 1 revision

An AdOverlay has more advanced features such as instance saving, custom animations and its callback event listeners. These features are an addition to the basic implementation.

Using animations

Interstitial Ad can be shown with a set of animations by providing animation type. This can be done by setting setPresentationStyle(AdformEnum.AnimationType). You can select from a set of animations:

  • AdformEnum.AnimationType.NO_ANIMATION - Ad is shown without an animation
  • AdformEnum.AnimationType.SLIDE - Ad is shown with a slide animation
  • AdformEnum.AnimationType.FADE - Ad is shown with a fade animation

By default, interstitial ad uses a FADE animation type.

Callback listeners

To get ad loader state setListener(AdOverlay.OverlayLoaderListener) should be used to get events when loading has succeeded/failed.

Note that, there is also a callback when there was as javascript error when showing an ad. In that case banner is not showed and user is indicated of that kind of event.

adLoader.setListener(new AdOverlay.OverlayLoaderListener() {
    @Override
    public void onLoadSuccess() {

    }

    @Override
    public void onLoadError(String error) {

    }

    @Override
    public void onShowError(String error) {

    }
});

To get ad loader show/hide states use adLoader.setStateListener(AdOverlay.OverlayStateListener);

adLoader.setStateListener(new AdOverlay.OverlayStateListener() {
    @Override
    public void onAdShown() {

    }

    @Override
    public void onAdClose() {

    }
});

Changing dim overlay in expand state

AdOverlay can enable/disable dimming when ad shows by using setDimOverlayEnabled(boolean).

Clone this wiki locally