CustomEventListener | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Methods | [Expand All]
public interface

# CustomEventListener

com.google.android.gms.ads.mediation.customevent.CustomEventListener

Known Indirect Subclasses CustomEventBannerListener, CustomEventInterstitialListener
CustomEventBannerListener | Custom events that implement `CustomEventBanner` should use this listener to send callbacks to the mediation library to properly manage ad flow.
CustomEventInterstitialListener | A custom event interstitial listener.

## Class Overview

A base custom event listener for banner and interstitial ads. Do not implement this interface directly. Instead, implement `CustomEventBannerListener` and/or `CustomEventInterstitialListener`.

## Summary

Public Methods
abstract void | onAdClicked() Indicates that the user has clicked on this custom event.
abstract void | onAdClosed() Indicates that the custom event rendered something in full screen and is now transferring control back to the application.
abstract void | onAdFailedToLoad(int errorCode) Indicates that an custom event request has failed along with the underlying cause.
abstract void | onAdLeftApplication() Indicates that user interaction with the custom event is causing the device to switch to a different application (such as a web browser).
abstract void | onAdOpened() Indicates that the custom event is rendering something that is full screen.

## Public Methods

#### public abstract void onAdClicked ()

Indicates that the user has clicked on this custom event. 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.

#### public abstract void onAdClosed ()

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

##### See Also

- `onAdOpened()`

#### public abstract void onAdFailedToLoad (int errorCode)

Indicates that an custom event 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 custom event must report either success or failure. If no response is received within a time limit, the mediation library may move on to another adapter, resulting in a potentially successful ad not being shown.

##### Parameters

errorCode | An error code detailing the cause of the failure. This may be any of `ERROR_CODE_INTERNAL_ERROR`, `ERROR_CODE_INVALID_REQUEST`, `ERROR_CODE_NETWORK_ERROR`, or `ERROR_CODE_NO_FILL`.

#### public abstract void onAdLeftApplication ()

Indicates that user interaction with the custom event 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.

#### public abstract void onAdOpened ()

Indicates that the custom event is rendering something that is full screen. This may be an `Activity`, or it may be a precursor to switching to a different application.

Once this screen is dismissed, `onAdClosed()` must be called.