> For the complete documentation index, see [llms.txt](https://aatkit.gitbook.io/android-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aatkit.gitbook.io/android-integration/other/admob-custom-events.md).

# AdMob Custom Events

### Introduction <a href="#markdown-header-admob-custom-events-requires-aatkit-234" id="markdown-header-admob-custom-events-requires-aatkit-234"></a>

* Requires the AATKit version 3.2 or later.
* AATKit supports AdMob custom events for banners, fullscreen ads, rewarded videos and native ads. This allows publishers integrating AdMob to receive ads from AATKit.

### How AATKit Google Mediation Adapter works: <a href="#markdown-header-how-aatkit-admob-mediation-adapter-works" id="markdown-header-how-aatkit-admob-mediation-adapter-works"></a>

* Publishers must prepare their AdMob dashboard adding custom events to their mediation
* AATKit mediation adapter implements AdMob custom events delegates
* AATKit mediation adapter internally calls AATKit whenever GoogleMobileAds asks for an ad request (that happens when the publisher request an ad through GoogleMobileAds)
* When AATKit responds, AATKit mediation adapter notifies the GoogleMobileAds with the request result using the AdMob custom events delegate methods

### Setup <a href="#markdown-header-aatkitadmobadapter-integration-steps" id="markdown-header-aatkitadmobadapter-integration-steps"></a>

First of all, you will need to add the AATKit's repository to your repositories list. Edit your main `build.gradle` file:

```gradle
allprojects {
    repositories {
        google()
        mavenCentral()
        //... other repositories you use
        maven { //AATKit repository
            url 'https://gravite-sdk-releases.s3.eu-central-1.amazonaws.com/aatkit/android/maven'
            content { includeGroupByRegex "com\\.intentsoftware\\..*" }
        }
    }
}
```

The adapter depends on AATKit, so the other repositories listed on the [Maven](/android-integration/start/setup/maven.md#integration-steps) page (GraviteRTB, PubNative, Mintegral) are needed as well.

Next add AATKit Google Mediation Adapter dependency to the `build.gradle` file. Please note the version of adapter corresponds to the used version of AATKit SDK.

```
dependencies {
    //... other dependencies you use
    implementation 'com.intentsoftware.addapptr:AATKitGoogleMediationAdapter:<AATKit_VERSION>'
}
```

{% hint style="warning" %}
Starting with AATKit 3.18, the adapter is built against the [GMA Next-Gen SDK](https://developers.google.com/admob/android/next-gen/quick-start). Your app's own Google Mobile Ads integration must use the Next-Gen SDK as well - the legacy `play-services-ads` SDK cannot be used together with the adapter. See [Google Mobile Ads SDK](/android-integration/ad-networks/google-mobile-ads-sdk.md) for details.
{% endhint %}

### Integration instructions <a href="#markdown-header-aatkitadmobadapter-integration-steps" id="markdown-header-aatkitadmobadapter-integration-steps"></a>

1. In the AdMob dashboard, click on mediation on the left menu
2. Create a new mediation for each ad format (Don't forget to choose the proper ad unit that you are using in your application in the GoogleMobileAds integration)
3. Open the newly created mediation and add a custom event
4. Edit the custom event and add the proper class name from the following:
   * Banner class name: `com.intentsoftware.addapptr.aatkitgooglemediationadapter.AddapptrEventBanner`
   * Interstitial class name: `com.intentsoftware.addapptr.aatkitgooglemediationadapter.AddapptrEventInterstitial`
   * Rewarded video class name: `com.intentsoftware.addapptr.aatkitgooglemediationadapter.AddapptrEventRewarded`
   * Native ads class name: `com.intentsoftware.addapptr.aatkitgooglemediationadapter.AddapptrEventNativeAd`
5. Integrate with GoogleMobileAds different ad formats following their documentation
6. Handle activity lifecycle by using `AATKitAdmobAdapter` public methods:

**Notify about activity resume**

{% tabs %}
{% tab title="Java" %}

```java
@Override
protected void onResume() {
    super.onResume();
    AATKitAdmobAdapter.resume(this);
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
override protected fun onResume() {
    super.onResume()
    AATKitAdmobAdapter.resume(this)
}
```

{% endtab %}
{% endtabs %}

**Notify about activity pause**

{% tabs %}
{% tab title="Java" %}

```java
@Override
protected void onPause() {
    AATKitAdmobAdapter.pause(this);
    super.onPause();
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
override protected fun onPause() {
    AATKitAdmobAdapter.pause(this)
    super.onPause()
}
```

{% endtab %}
{% endtabs %}
