MediationBannerListener

public interface MediationBannerListener


Callback for an adapter to communicate back to the mediation library. Events must be communicated back for the mediation library to properly manage ad flow.

The [onAdClicked] method in particular is required for metrics to operate correctly.

Summary

Public methods

abstract void

Indicates that the user has clicked on this ad.

abstract void

Indicates that the ad control rendered something in full screen and is now transferring control back to the application.

abstract void
onAdFailedToLoad(
    @NonNull MediationBannerAdapter adapter,
    @NonNull AdError adError
)

Indicates that an ad request failed to load.

abstract void

This method is deprecated. Use {@link #onAdFailedToLoad(MediationBannerAdapter, AdError)} instead.

abstract void

Indicates that the ad is causing the device to switch to a different application (such as a web browser).

abstract void

Indicates that an ad has been requested and successfully received.

abstract void

Indicates that the ad control is rendering something that is full screen.

abstract void
onAppEvent(
    @NonNull MediationBannerAdapter adapter,
    @NonNull String name,
    @NonNull String data
)

Indicates that an app event occurred on this ad.

Public methods

onAdClicked

abstract void onAdClicked(@NonNull MediationBannerAdapter adapter)

Indicates that the user has clicked on this ad. This is used for publisher metrics, and must be called in addition to any other events; this event is never inferred by the mediation library. For example, onAdLeftApplication would generally mean that the user has clicked on an ad, but onAdClicked must be called regardless.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

onAdClosed

abstract void onAdClosed(@NonNull MediationBannerAdapter adapter)

Indicates that the ad control rendered something in full screen and is now transferring control back to the application. This may be the user returning from a different application.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

onAdFailedToLoad

abstract void onAdFailedToLoad(
    @NonNull MediationBannerAdapter adapter,
    @NonNull AdError adError
)

Indicates that an ad request failed to load.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

@NonNull AdError adError

AdError detailing the cause of the failure.

onAdFailedToLoad

abstract void onAdFailedToLoad(@NonNull MediationBannerAdapter adapter, int error)

Indicates that an ad request has failed along with the underlying cause. A failure may be an actual error or just a lack of fill.

Once an ad is requested, the adapter must report either success or failure. If no response is heard within a time limit, the mediation library may move on to another adapter, resulting in a potentially successful ad not being shown.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

int error

An error code detailing the cause of the failure.

onAdLeftApplication

abstract void onAdLeftApplication(@NonNull MediationBannerAdapter adapter)

Indicates that the ad is causing the device to switch to a different application (such as a web browser). This must be called before the current application is put in the background.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

onAdLoaded

abstract void onAdLoaded(@NonNull MediationBannerAdapter adapter)

Indicates that an ad has been requested and successfully received. Banner ads may be automatically displayed after this method has been called.

Once an ad is requested, the adapter must report either success or failure. If no response is heard within a time limit, the mediation library may move on to another adapter, resulting in a potentially successful ad not being shown.

From the point when this method is called until the adapter is destroyed, MediationBannerAdapter.getBannerView must return a android.view.View object; null is not permitted. The same android.view.View object must be returned on every request.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

onAdOpened

abstract void onAdOpened(@NonNull MediationBannerAdapter adapter)

Indicates that the ad control is rendering something that is full screen. This may be an android.app.Activity, or it may be a precursor to switching to a different application.

Once this screen is dismissed, onAdClosed must be called.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

onAppEvent

abstract void onAppEvent(
    @NonNull MediationBannerAdapter adapter,
    @NonNull String name,
    @NonNull String data
)

Indicates that an app event occurred on this ad.

Parameters
@NonNull MediationBannerAdapter adapter

The mediation adapter which raised the event.

@NonNull String name

The name of the app event.

@NonNull String data

Extra data included with the app event.