<br />

This guide shows you how to use GMA Next-Gen SDK to load and display
ads from maio using [AdMob Mediation](https://developers.google.com/admob/android/next-gen/mediation.md.txt),
covering waterfall integrations. It covers how to add maio to an ad unit's
mediation configuration, and how to integrate the maio SDK and adapter into an
Android app.

The dashboard interface for maio uses Japanese text for its labels, buttons,
and descriptions, and the screenshots in this guide have not been translated.
In this guide's descriptions and instructions however, labels and buttons are
referenced with their English language equivalents. "URL スキーム," for example,
is "URL Scheme".

## Supported integrations and ad formats

The mediation adapter for maio has the following capabilities:

| Integration ||
|---|---|
| Bidding |   |
| Waterfall | Yes |
| Banner | Yes |
| Interstitial | Yes |
| Rewarded | Yes |
| Native |   |

## Prerequisites

Before you continue, verify the following:

- Android API level 24 or later.

<!-- -->

- maio SDK 1.0.7 or later.

<!-- -->

- Latest GMA Next-Gen SDK version.

- [Set up AdMob Mediation](https://developers.google.com/admob/android/next-gen/mediation.md.txt).

## Step 1: Set up configurations in maio UI

First, [sign up](https://docs.google.com/forms/d/e/1FAIpQLScSrlf8JTwTdvJjaLjc3v4z8PfunngKALSBdRf3EfyctdMY3Q/viewform)
or [log in](https://maio.jp/publisher/login) to your maio account. Click the
**Application management** button on the left sidebar and click on **New app**.

![](https://developers.google.com/static/admob/images/mediation/maio/new-app.png)

Select the tab corresponding to your preferred **Ad Type**.

### Interstitial

Enter the **Name** of your app, select the platform and provide your
**App URL** . Select **Video interstitial** as the **Ad Type** , and then
click **Update**.

![](https://developers.google.com/static/admob/images/mediation/maio/interstitial_Android.png)
**Note:** Interstitial ads from maio are skippable by default.

### Rewarded

Enter the **Name** of your app, select the platform and provide your
**App URL** . Select **Video Rewards** as the **Ad Type** , and then click
**Update**.

![](https://developers.google.com/static/admob/images/mediation/maio/rewarded_Android.png)
**Note:** Rewarded Video ads from maio are **NOT** skippable by default.

In the **Application Management** page, make a note of the **Media ID**. It's
needed to set up your AdMob ad unit in the next
section.

![](https://developers.google.com/static/admob/images/mediation/maio/media_id_Android.png)

In the **Zone Management** page, make a note of the **Zone ID**. It will also
be needed to set up your AdMob ad unit in the next
section.

![](https://developers.google.com/static/admob/images/mediation/maio/zone_id_Android.png)
In addition to **Media ID** and **Zone ID** , you will need **API ID** and **API KEY** to set up your ad unit ID for mediation. In **Reporting API page** , make a note of **API ID** and **API KEY** .

<br />

![](https://developers.google.com/static/admob/images/mediation/maio/api_id_key.png)

> [!NOTE]
> **Note:** If this is your first time setting up your maio account, you may need to contact maio's support team in order for your **API ID** and **API KEY** to be issued to you.

## Step 2: Set up maio demand in AdMob UI

### Configure mediation settings for your ad unit

You need to add maio to the
mediation configuration for your ad unit.

First, sign in to your [AdMob account](https://apps.admob.com/). Next, navigate to the
**Mediation** tab. If you have an existing mediation group you'd like to modify,
click the name of that mediation group to edit it, and skip ahead to
[Add maio as an ad source](https://developers.google.com/admob/android/next-gen/mediation/maio.md.txt#add-ad-source).

To create a new mediation group, select **Create Mediation Group**.

![](https://developers.google.com/static/admob/images/mediation/admob-mediation-group-create.png)

Enter your ad format and platform, then click **Continue**.

![](https://developers.google.com/static/admob/images/mediation/admob-mediation-group-new-Android.png)

Give your mediation group a name, and select locations to target. Next, set the
mediation group status to **Enabled** , and then click **Add Ad Units**.

![](https://developers.google.com/static/admob/images/mediation/admob-mediation-group-details-Android.png)

Associate this mediation group with one or more of your existing
AdMob ad units. Then click **Done**.

![](https://developers.google.com/static/admob/images/mediation/admob-ad-units-select-Android.png)

You should now see the ad units card populated with the ad units you selected:

![](https://developers.google.com/static/admob/images/mediation/admob-ad-units-card-Android.png)

### Add maio as an ad source

<br />

Under the **Waterfall** card in the **Ad Sources** section, select **Add Ad
Source** .  

Select **maio** and enable the **Optimize** switch. Enter the **API ID** and **API KEY** obtained in the previous section to set up ad source optimization for maio. Then enter an **eCPM value** for maio and click **Continue** .  

![](https://developers.google.com/static/admob/images/mediation/maio/admob-add-ad-network.png)  

> [!NOTE]
> **Note**: You only need to set up ad source optimization once per network.

<br />

If you already have a mapping for maio, you can select it. Otherwise, click **Add mapping** .  

![](https://developers.google.com/static/admob/images/mediation/maio/waterfall-add-mapping-1-Android.png)  

Next, enter the **Media ID** and **Zone ID** obtained in the previous section. Then click **Done** .  
**Important** : The **Media ID** must be associated with the targeted app as in the maio UI.   
![](https://developers.google.com/static/admob/images/mediation/maio/waterfall-add-mapping-2-Android.png)  

> [!NOTE]
> **Note** : Ad source optimization takes a few days to gather enough data to accurately calculate eCPM for a mediation network. In the meantime, the ad source optimization status is `PENDING`, so you must manually set an eCPM value for the network. Once the eCPM can be calculated, the ad source automatically starts updating the eCPM on your behalf.

## Step 3: Import the maio SDK and adapter

> [!NOTE]
> **Note:** Failure to integrate the compatible maio and GMA Next-Gen SDK versions might lead to build issues.

### Android Studio integration (recommended)

In your project-level `settings.gradle.kts` file, add the following
repositories:

```kotlin
dependencyResolutionManagement {
  repositories {
    google()
    mavenCentral()
    maven {
url = uri("https://imobile-maio.github.io/maven")
}
  }
}
```

In your app-level gradle file, add the following implementation dependencies
and configurations:

### Kotlin

```kotlin
dependencies {
    implementation("com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:1.6.0")
    implementation("com.google.ads.mediation:maio:2.0.9.1")
}

configurations.configureEach {
    exclude(group = "com.google.android.gms", module = "play-services-ads")
    exclude(group = "com.google.android.gms", module = "play-services-ads-lite")
}
```

### Groovy

```groovy
dependencies {
    implementation 'com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:1.6.0'
    implementation 'com.google.ads.mediation:maio:2.0.9.1'
}

configurations.configureEach {
    exclude group: 'com.google.android.gms', module: 'play-services-ads'
    exclude group: 'com.google.android.gms', module: 'play-services-ads-lite'
}
```

### Manual integration

- Download the latest version of [maio Android SDK](https://github.com/imobile-maio/maio-Android-SDK/releases) and add it to your project.
- Navigate to the [maio adapter artifacts](https://maven.google.com/web/index.html?q=maio#com.google.ads.mediation:maio) on Google's Maven Repository. Select the latest version, download the maio adapter's \`.aar' file, and add it to your project.

## Step 4: Add required code

No additional code is required for maio Android integration.

## Step 5: Test your implementation

### Enable test ads

Make sure you
[register your test device](https://developers.google.com/admob/android/next-gen/test-ads.md.txt#enable_test_devices)
for

AdMob.


Publishers using version 11.6.0 or higher of GMA Next-Gen SDK will
automatically receive test ads from maio on phones and tablets registered as
[test devices](https://developers.google.com/admob/android/next-gen/test-ads.md.txt#add_your_test_device)
when making requests.

> [!IMPORTANT]
> **Important:** Disable test mode for AdMob and maio before releasing your app.

### Verify test ads

To verify that you are receiving test ads from
maio,
enable
[single ad source testing](https://developers.google.com/admob/android/next-gen/ad-inspector.md.txt#single_ad_source_testing)
in ad inspector using the
**maio (Waterfall)** ad source(s).

## Error codes

If the adapter fails to receive an ad from maio,
publishers can check the underlying error from the ad response using


[`ResponseInfo.getAdSourceResponses()`](https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/ResponseInfo.md.txt#getAdSourceResponses())

under the following classes:

| Format | Class name |
|---|---|
| Interstitial | jp.maio.sdk.android.mediation.admob.adapter.Interstitial |
| Rewarded | jp.maio.sdk.android.mediation.admob.adapter.Rewarded |

Here are the codes and accompanying messages thrown by the maio adapter when an ad fails to load:

| Error code | Reason |
|---|---|
| 0-10 | maio returned an SDK-specific error. See [code](https://github.com/googleads/googleads-mobile-android-mediation/blob/cd4c87f4e61adcf1bacc69da8c1f69d972105672/ThirdPartyAdapters/maio/maio/src/main/java/com/google/ads/mediation/maio/MaioMediationAdapter.java#L64-L78) and maio's [documentation](https://github.com/imobile-maio/maio-Android-SDK/wiki/API-Reference-(EN)#failnotificationreason-enum-1) for more details. |
| 101 | Maio does not have an ad available. |
| 102 | Invalid server parameters (e.g. missing Placement ID). |
| 103 | Context used to load an ad was not an \`Activity\` instance. |
| 104 | The request had age-restricted treatment, but maio SDK cannot receive age-restricted signals |

## maio Android Mediation Adapter Changelog

#### Next Version

- Updated the adapter to use the `InitializationCompleteCallback.onInitializationFailed(AdError)` API.
- Updated the minimum required Android API level to 24.

#### Version 2.0.9.1

- Pin the adapter's Kotlin dependency to 1.9.0 (the min Kotlin version supported by GMA NextGen SDK).
- Fixed fall-through behavior on age-restricted failure branches during ad initialization and ad load requests.

Built and tested with:

- Google Mobile Ads SDK version 25.4.0.
- Google Mobile Ads Next-Gen SDK version 1.5.0.
- Maio SDK version 2.0.9.1.

#### Version 2.0.9.0

- Filter age-restricted requests for maio SDK when new `AgeRestrictedTreatment` is set to `CHILD`.
- Verified compatibility with maio SDK version 2.0.9.

Built and tested with:

- Google Mobile Ads SDK version 25.4.0.
- Google Mobile Ads Next-Gen SDK version 1.3.1.
- Maio SDK version 2.0.9.0.

#### Version 2.0.8.2

- Filter age-restricted requests for maio SDK because it cannot receive age-restricted signals.
- Added property to build the adapter with GMA Next-Gen SDK dependency.

Built and tested with:

- Google Mobile Ads SDK version 25.1.0.
- Google Mobile Ads Next-Gen SDK version 1.1.0.
- Maio SDK version 2.0.8.2.

#### Version 2.0.8.1

- Added Banner ad format support

Built and tested with:

- Google Mobile Ads SDK version 25.0.0.
- Maio SDK version 2.0.8.1.

#### Version 2.0.8.0

- Verified compatibility with maio SDK version 2.0.8.

Built and tested with:

- Google Mobile Ads SDK version 24.9.0.
- Maio SDK version 2.0.8.0.

#### Version 2.0.7.0

- Verified compatibility with maio SDK version 2.0.7.

Built and tested with:

- Google Mobile Ads SDK version 24.7.0.
- Maio SDK version 2.0.7.0.

#### Version 2.0.6.0

- Removed class-level references to Context. Can help reduce memory leak issues
- Verified compatibility with maio SDK version 2.0.6.

Built and tested with:

- Google Mobile Ads SDK version 24.6.0.
- Maio SDK version 2.0.6.0.

#### Version 2.0.5.0

- Verified compatibility with maio SDK version 2.0.5.

Built and tested with:

- Google Mobile Ads SDK version 24.4.0.
- Maio SDK version 2.0.5.0.

#### Version 2.0.4.0

- Verified compatibility with maio SDK version 2.0.4.

Built and tested with:

- Google Mobile Ads SDK version 24.3.0.
- Maio SDK version 2.0.4.0.

#### Version 2.0.3.1

- Updated the minimum required Android API level to 23.
- Updated the minimum required Google Mobile Ads SDK version to 24.0.0.

Built and tested with:

- Google Mobile Ads SDK version 24.0.0.
- Maio SDK version 2.0.3.0.

#### Version 2.0.3.0

- Verified compatibility with maio SDK version 2.0.3.0.

Built and tested with:

- Google Mobile Ads SDK version 23.6.0.
- Maio SDK version 2.0.3.0.

#### Version 1.1.16.3

- Updated the minimum required Google Mobile Ads SDK version to 23.0.0.
- Verified compatibility with maio SDK version 1.1.16.

Built and tested with:

- Google Mobile Ads SDK version 23.0.0.
- Maio SDK version 1.1.16.

#### Version 1.1.16.2

- Updated adapter to use new `VersionInfo` class.
- Updated the minimum required Google Mobile Ads SDK version to 22.0.0.

Built and tested with:

- Google Mobile Ads SDK version 22.0.0.
- Maio SDK version 1.1.16.

#### Version 1.1.16.1

- Updated `compileSdkVersion` and `targetSdkVersion` to API 31.
- Updated the minimum required Google Mobile Ads SDK version to 21.0.0.
- Updated the minimum required Android API level to 19.

Built and tested with:

- Google Mobile Ads SDK version 21.0.0.
- Maio SDK version 1.1.16.

#### Version 1.1.16.0

- Updated error codes to capture additional maio errors.
- Verified compatibility with maio SDK version 1.1.16.
- Updated the minimum required Google Mobile Ads SDK version to 20.4.0.

Built and tested with:

- Google Mobile Ads SDK version 20.4.0.
- Maio SDK version 1.1.16.

#### Version 1.1.15.0

- Verified compatibility with maio SDK version 1.1.15.
- Updated the minimum required Google Mobile Ads SDK version to 20.0.0.

Built and tested with:

- Google Mobile Ads SDK version 20.0.0.
- Maio SDK version 1.1.15.

#### Version 1.1.14.0

- Added standardized adapter error codes and messages.
- Verified compatibility with maio SDK version 1.1.14.
- Updated the minimum required Google Mobile Ads SDK version to 19.8.0.

Built and tested with:

- Google Mobile Ads SDK version 19.8.0.
- Maio SDK version 1.1.14.

#### Version 1.1.13.0

- Verified compatibility with maio SDK version 1.1.13.
- Updated the minimum required Google Mobile Ads SDK version to 19.5.0.

Built and tested with:

- Google Mobile Ads SDK version 19.5.0.
- Maio SDK version 1.1.13.

#### Version 1.1.12.0

- Updated the minimum required Google Mobile Ads SDK version to 19.4.0.

Built and tested with:

- Google Mobile Ads SDK version 19.4.0.
- Maio SDK version 1.1.12.

#### Version 1.1.11.1

- To limit timouts, ad requests will now immediately fail if maio does not have an ad ready to be shown.
- Updated the minimum required Google Mobile Ads SDK version to 19.1.0.

Built and tested with:

- Google Mobile Ads SDK version 19.1.0.
- Maio SDK version 1.1.11.

#### Version 1.1.11.0

- Verified compatibility with maio SDK version 1.1.11.
- Updated the minimum required Google Mobile Ads SDK version to 18.3.0.

Built and tested with:

- Google Mobile Ads SDK version 18.3.0.
- Maio SDK version 1.1.11.

#### Version 1.1.10.0

- Verified compatibility with maio SDK version 1.1.10.
- Updated the minimum required Google Mobile Ads SDK version to 18.2.0.

#### Version 1.1.8.0

- Verified compatibility with maio SDK version 1.1.8.
- Updated the minimum required Google Mobile Ads SDK version to 18.1.0.

#### Version 1.1.7.0

- Bug Fixes.
- Verified compatibility with maio SDK version 1.1.7.

#### Version 1.1.6.1

- Updated adapter to support new Rewarded API.
- Updated the minimum required Google Mobile Ads SDK version to 17.2.0.

#### Version 1.1.6.0

- Verified compatibility with maio SDK version 1.1.6.

#### Version 1.1.5.0

- Verified compatibility with maio SDK version 1.1.5.

#### Version 1.1.4.0

- Verified compatibility with maio SDK version 1.1.4.

#### Version 1.1.3.1

- Updated the adapter to work with instance class instead of singleton.

#### Version 1.1.3.0

- Verified compatibility with maio SDK version 1.1.3.

#### Version 1.1.2.1

- Updated the adapter with updated initialize functions.

#### Version 1.1.2.0

- Verified compatibility with maio SDK version 1.1.2.

#### Version 1.1.1.1

- Updated the adapter to invoke the `onRewardedVideoComplete()` ad event.

#### Version 1.1.1.0

- Verified compatibility with maio SDK version 1.1.1.

#### Version 1.1.0.0

- Verified compatibility with maio SDK version 1.1.0.

#### Version 1.0.8.0

- Verified compatibility with maio SDK version 1.0.8.

#### Version 1.0.7.1

- Fixed an issue that could cause NullPointerExceptions to occur when ads fail to load.

#### Version 1.0.7.0

- Added ability to enable test mode by adding test device id to `AdRequest`.
- Verified compatibility with maio SDK version 1.0.7.

#### Version 1.0.6.0

- First release!
- Added support for interstitials and rewarded video ads.