CustomEventBanner

public interface CustomEventBanner extends CustomEvent


A custom event to support banner ads.

The typical life-cycle for a custom event is to have requestBannerAd called once. At this point the adapter should create a android.view.View and report to the either onAdLoaded or onAdFailedToLoad. 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 requestBannerAd 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 adapter is expected to expose events via the CustomEventBannerListener passed in the requestBannerAd call. All parameters necessary to make an ad request should be passed in the serverParameter, MediationAdRequest, and customEventExtras parameters.

Summary

Public methods

abstract void
requestBannerAd(
    Context context,
    CustomEventBannerListener listener,
    @Nullable String serverParameter,
    AdSize size,
    MediationAdRequest mediationAdRequest,
    @Nullable Bundle customEventExtras
)

Called by the mediation library to request a view from the custom event.

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

requestBannerAd

abstract void requestBannerAd(
    Context context,
    CustomEventBannerListener listener,
    @Nullable String serverParameter,
    AdSize size,
    MediationAdRequest mediationAdRequest,
    @Nullable Bundle customEventExtras
)

Called by the mediation library to request a view from the custom event.

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 AdView which will contain the custom event . An android.app.Activity is preferred.

CustomEventBannerListener 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.

AdSize size

The size of the view to fetch. The size of the view should be as close as possible to the size specified in this parameter. If this view size is not supported, the request should fail and onAdFailedToLoad should be called.

MediationAdRequest mediationAdRequest

Generic targeting parameters to use when requesting a view.

@Nullable Bundle customEventExtras

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