<br />

This guide shows you how to use Google Mobile Ads Flutter Plugin to load and display
ads from i-mobile using [mediation](https://developers.google.com/admob/flutter/mediation.md.txt),
covering waterfall integrations. It covers how to add i-mobile to an ad unit's
mediation configuration, and how to integrate the i-mobile SDK and adapter into
a Flutter app.

The dashboard interface for i-mobile uses Japanese text for its labels,
buttons, and descriptions. The screenshots in this guide have not been
translated. In this guide's descriptions and instructions however, labels and
buttons are translated with their English language equivalents in parentheses.

## Supported integrations and ad formats

The AdMob mediation adapter for i-mobile has the
following capabilities:

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

## Prerequisites

Before you continue, verify the following:

- Latest Google Mobile Ads Flutter Plugin version.
- Flutter framework version 3.7.0 or later.
- To deploy on Android
  - Android API level 24 or later.
- To deploy on iOS
  - iOS deployment target of 13.0 or later.
- A working Flutter project configured with Google Mobile Ads Flutter Plugin. See [Set up Google Mobile Ads Flutter Plugin](https://developers.google.com/admob/flutter/quick-start.md.txt) for details.

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

## Step 1: Set up configurations in i-mobile UI

- [Sign up](https://www2.i-mobile.co.jp/pre_register_partner.aspx) or [log
  in](https://sppartner.i-mobile.co.jp/login.aspx) to your i-mobile account.
- Add your app to the i-mobile dashboard by clicking the **サイト／アプリ管理 (Site/Application Management)** tab and the button for your app's platform.

### Android

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

### iOS

![](https://developers.google.com/static/admob/images/mediation/imobile/select_platform_iOS.png)
- Fill out the form and click the **新規登録 (Sign up)** button.

### Android

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

### iOS

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

> [!NOTE]
> **Note:** i-mobile has to approve your registration. Once you are approved, you can create an **Advertising Spot**.

- To create a new Advertising Spot, select your app under the **サイト／アプリ管理 (Site/Application Management)** tab.

### Android

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

### iOS

![](https://developers.google.com/static/admob/images/mediation/imobile/app_list_iOS.png)
- Navigate to the **広告スポット管理 (Ad Spot Management)** tab and click the **新規広告スポット (New Ad Spot)** button.
- ![create_ad_spot](https://developers.google.com/static/admob/images/mediation/imobile/create_ad_spot.png)
- Next, fill out the form by providing the **広告スポット名 (Ad Spot name)** , **広告スポットサイズ (Ad Spot size)** and other details. Then, click the **新規登録 (Sign up)** button.
- ![new_ad_spot_form](https://developers.google.com/static/admob/images/mediation/imobile/new_ad_spot_form.png)
- Your new **Ad spot** is ready. To view its integration details, click the **アプリ設定取得 (Get App settings)** button.
- ![ad_spot_list](https://developers.google.com/static/admob/images/mediation/imobile/ad_spot_list.png)
- Take note of the **パブリッシャーID (Publisher ID)** , **メディアID (Media ID)** , and **スポットID (Spot ID)**. You'll need these parameters later when configuring i-mobile for mediation in the AdMob UI.

### Android

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

### iOS

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

### Update your app-ads.txt

- [Authorized Sellers for Apps app-ads.txt](https://iabtechlab.com/wp-content/uploads/2019/03/app-ads.txt-v1.0-final-.pdf) is an IAB Tech Lab initiative that helps ensure your app ad inventory is only sold through channels you've identified as authorized. To prevent a significant loss in ad revenue, you'll need to implement an `app-ads.txt` file. If you haven't done so already, [set up an app-ads.txt file for your app](https://support.google.com/admob/answer/9363762).
- To implement `app-ads.txt` for i-mobile, see their [Frequently Asked Questions](https://www.i-mobile.co.jp/help_partner_sp.html#3-10).

## Step 2: Set up i-mobile demand in AdMob UI

### Configure mediation settings for your ad unit

### Android

For instructions, see step 2 in the guide for

[Android](https://developers.google.com/admob/android/mediation/imobile.md.txt#step-2).

### iOS

For instructions, see step 2 in the guide for

[iOS](https://developers.google.com/admob/ios/mediation/imobile.md.txt#step-2).

## Step 3: Import the i-mobile SDK and adapter

> [!NOTE]
> **Note:** Failure to integrate the compatible i-mobile and Google Mobile Ads SDK versions might lead to build issues.

### Integration through pub.dev

- (Android only) Add the following repositories to the `build.gradle` file inside your project's `android` directory:

```groovy
  repositories {
      google()
      mavenCentral()
      maven {
url = uri("https://imobile.github.io/adnw-sdk-android")
}
  }
```
- Add the following dependency with the latest versions of the i-mobile SDK and adapter in your package's `pubspec.yaml` file:

```yaml
dependencies:
  gma_mediation_imobile: ^1.0.6
```

### Manual Integration

- Download the latest version of Google Mobile Ads mediation plugin for [i-mobile](https://pub.dev/packages/gma_mediation_imobile/versions), extract the downloaded file, and add the extracted plugin folder (and its contents) to your Flutter project. Then, reference the plugin in your `pubspec.yaml` file by adding the following dependency:

```yaml
dependencies:
  gma_mediation_imobile:
    path: path/to/local/package
```

## Step 4: Additional code required

### Android

No additional code is required i-mobile integration.

### iOS

### SKAdNetwork integration

Follow [i-mobile's documentation](https://sppartner.i-mobile.co.jp/webdoc/index.html#objective-c/ios14.html)
to add the SKAdNetwork identifiers to your project's `Info.plist` file.

## Step 5: Test your implementation

### Enable test ads

- Make sure you [register your test device](https://developers.google.com/admob/flutter/test-ads.md.txt#enable_test_devices) for AdMob. i-mobile provides test **Spot ID** , **Media ID** , and **Publisher ID** for testing, you can find them [here](https://sppartner.i-mobile.co.jp/webdoc/common/test-id.html).

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

### Verify test ads

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

## Error codes

- If the adapter fails to receive an ad from i-mobile, publishers can check the underlying error from the ad response using [`ResponseInfo`](https://developers.google.com/admob/flutter/response-info.md.txt) under the following classes:

### Android

| Format | Class name |
|---|---|
| Banner | com.google.ads.mediation.imobile.IMobileAdapter |
| Interstitial | com.google.ads.mediation.imobile.IMobileAdapter |
| Native | com.google.ads.mediation.imobile.IMobileMediationAdapter |

### iOS

| Format | Class name |
|---|---|
| Banner | IMobileAdapter |
| Interstitial | IMobileAdapter |
| Native | GADMediationAdapterIMobile |

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

### Android

| Error code | Reason |
|---|---|
| 0-99 | i-mobile SDK returned an error. See [code](https://github.com/googleads/googleads-mobile-android-mediation/blob/master/ThirdPartyAdapters/imobile/imobile/src/main/java/com/google/ads/mediation/imobile/AdapterHelper.java) for more details. |
| 101 | i-mobile requires an `Activity` context to load ads. |
| 102 | i-mobile server parameters configured in the AdMob UI are missing or invalid. |
| 103 | The requested ad size does not match an i-mobile supported banner size. |
| 104 | i-mobile's native ad load success callback returned an empty native ads list. |

### iOS

| Error code | Reason |
|---|---|
| 0-10 | i-mobile SDK returned an error. See [code](https://github.com/imobile/adnw-sdk-ios/blob/master/ImobileSdkAds.framework/Headers/ImobileSdkAds.h) for more details. |
| 101 | i-mobile server parameters configured in the AdMob UI are missing or invalid. |
| 102 | The requested ad size does not match an i-mobile supported banner size. |
| 103 | i-mobile failed to present an ad. |
| 104 | i-mobile returned an empty native ad array. |
| 105 | i-mobile failed to download native ad assets. |
| 106 | i-mobile does not support requesting for multiple interstitial ads using the same Spot ID. |

## i-mobile Flutter Mediation Adapter Changelog

#### Version 1.0.6

  - Supports [i-mobile Android adapter version 2.3.2.5](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2325).
  - Supports [i-mobile iOS adapter version 2.3.4.8](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2348).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 1.0.5

  - Updated to support Google Mobile Ads Flutter Plugin version 9.1.0.
  - Add Swift Package Manager support.
  - Supports [i-mobile Android adapter version 2.3.2.4](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2324).
  - Supports [i-mobile iOS adapter version 2.3.4.8](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2348).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 1.0.4

  - Supports [i-mobile Android adapter version 2.3.2.3](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2323).
  - Supports [i-mobile iOS adapter version 2.3.4.7](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2347).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 8.0.0.

#### Version 1.0.3

  - Updated minimum Flutter version to 3.38.1
  - Updated to support Google Mobile Ads Flutter Plugin version 8.0.0
  - Supports [i-mobile Android adapter version 2.3.2.3](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2323).
  - Supports [i-mobile iOS adapter version 2.3.4.6](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2346).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 8.0.0.

#### Version 1.0.2

  - Supports [i-mobile Android adapter version 2.3.2.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2321).
  - Supports [i-mobile iOS adapter version 2.3.4.3](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2343).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.0.1

  - Supports [i-mobile Android adapter version 2.3.2.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2321).
  - Supports [i-mobile iOS adapter version 2.3.4.2](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2342).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.0.0

  - Initial release.
  - Supports [i-mobile Android adapter version 2.3.2.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/imobile/CHANGELOG.md#version-2320).
  - Supports [i-mobile iOS adapter version 2.3.4.1](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/I-Mobile/CHANGELOG.md#version-2341).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.3.1.