# CustomEventInterstitial

# CustomEventInterstitial


```
interface CustomEventInterstitial : CustomEvent
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
>
> Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/Adapter` instead.

A custom event that supports interstitial ads.

The typical life-cycle for a custom event is to have `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#requestInterstitialAd(android.content.Context,com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener,java.lang.String,com.google.android.gms.ads.mediation.MediationAdRequest,android.os.Bundle)` called once. At this point the adapter should request an ad and report either `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEvent#onDestroy()`, though this is not guaranteed. Note that `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#requestInterstitialAd(android.content.Context,com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener,java.lang.String,com.google.android.gms.ads.mediation.MediationAdRequest,android.os.Bundle)` 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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener` passed in the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#requestInterstitialAd(android.content.Context,com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener,java.lang.String,com.google.android.gms.ads.mediation.MediationAdRequest,android.os.Bundle)` call. All parameters necessary to make an ad request should be passed in the `serverParameter`, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/MediationAdRequest`, and `
customEventExtras` parameters.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `[requestInterstitialAd](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#requestInterstitialAd(android.content.Context,com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener,java.lang.String,com.google.android.gms.ads.mediation.MediationAdRequest,android.os.Bundle))( context: https://developer.android.com/reference/android/content/Context.html!, listener: https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener!, serverParameter: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?, mediationAdRequest: https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/MediationAdRequest!, customEventExtras: https://developer.android.com/reference/android/os/Bundle.html? )` Called by the mediation library to request an interstitial. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `[showInterstitial](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#showInterstitial())()` Show the interstitial. |

| ### Inherited functions |
|---|
| From [com.google.android.gms.ads.mediation.customevent.CustomEvent](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEvent) |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `[onDestroy](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEvent#onDestroy())()` Tears down the adapter control. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `[onPause](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEvent#onPause())()` Called when the application calls `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#pause()`. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `[onResume](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEvent#onResume())()` Called when the application calls `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#resume()`. | |

## Public functions

### requestInterstitialAd

```
fun [requestInterstitialAd](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#requestInterstitialAd(android.content.Context,com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener,java.lang.String,com.google.android.gms.ads.mediation.MediationAdRequest,android.os.Bundle))(
    context: Context!,
    listener: CustomEventInterstitialListener!,
    serverParameter: String?,
    mediationAdRequest: MediationAdRequest!,
    customEventExtras: Bundle?
): Unit
```

Called by the mediation library to request an interstitial.

If the request is successful, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener#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: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html` of the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/interstitial/InterstitialAd` that requested the custom event interstitial. An `https://developer.android.com/reference/android/app/Activity.html` is preferred. |
| `listener: https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener!` | Listener to custom event with callbacks for various events. |
| `serverParameter: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | The string configured in the publisher UI as the parameter for the custom event. |
| `mediationAdRequest: https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/MediationAdRequest!` | Generic targeting parameters to use when requesting an interstitial. |
| `customEventExtras: https://developer.android.com/reference/android/os/Bundle.html?` | A `https://developer.android.com/reference/android/os/Bundle.html` of parameters set by the publisher on a per-request basis. |

### showInterstitial

```
fun [showInterstitial](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitial#showInterstitial())(): Unit
```

Show the interstitial. This may be called any time after a call to `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/mediation/customevent/CustomEventInterstitialListener#onAdLoaded()`.