CustomEventInterstitial

public interface CustomEventInterstitial extends CustomEvent


A custom event that supports interstitial ads.

The typical life-cycle for a custom event is to have requestInterstitialAd called once. At this point the adapter should request an ad and report either onAdLoaded or onAdFailedToLoad to the listener. Subsequent requests will be made with a new instance of the custom event. At the end of the life cycle, a best effort is made to call onDestroy, though this is not guaranteed. Note that requestInterstitialAd is called on the UI thread so all the standard precautions of writing code on that thread apply. In particular, the code should not call any blocking methods.

The custom event is expected to forward events via the CustomEventInterstitialListener passed in the requestInterstitialAd call. All parameters necessary to make an ad request should be passed in the serverParameter, MediationAdRequest, and customEventExtras parameters.

Summary

Public methods

abstract void
requestInterstitialAd(
    Context context,
    CustomEventInterstitialListener listener,
    @Nullable String serverParameter,
    MediationAdRequest mediationAdRequest,
    @Nullable Bundle customEventExtras
)

Called by the mediation library to request an interstitial.

abstract void

Show the interstitial.

Inherited methods

From com.google.android.gms.ads.mediation.customevent.CustomEvent
abstract void

Tears down the adapter control.

abstract void

Called when the application calls pause.

abstract void

Called when the application calls resume.

Public methods

requestInterstitialAd

abstract void requestInterstitialAd(
    Context context,
    CustomEventInterstitialListener listener,
    @Nullable String serverParameter,
    MediationAdRequest mediationAdRequest,
    @Nullable Bundle customEventExtras
)

Called by the mediation library to request an interstitial.

If the request is successful, onAdLoaded should be called.

If the request is unsuccessful, onAdFailedToLoad should be called on the listener with an appropriate error cause.

This method is called on the UI thread so all the standard precautions of writing code on that thread apply. In particular your code should not call any blocking methods.

Parameters
Context context

The Context of the that requested the custom event interstitial. An android.app.Activity is preferred.

CustomEventInterstitialListener listener

Listener to custom event with callbacks for various events.

@Nullable String serverParameter

The string configured in the publisher UI as the parameter for the custom event.

MediationAdRequest mediationAdRequest

Generic targeting parameters to use when requesting an interstitial.

@Nullable Bundle customEventExtras

A Bundle of parameters set by the publisher on a per-request basis.

showInterstitial

abstract void showInterstitial()

Show the interstitial. This may be called any time after a call to onAdLoaded.