Skip to content

umitkose1/mediationadaptersmaato

Repository files navigation

Huawei-Smaato Mediation Github Documentation

Introduction

In this documentation we explained how to use Huawei-Smaato mediation with in the different platforms.

Compatibility

| | Banner Ad | Interstitial Ad |

How to start?

Create an ad unit on Huawei Publisher Service

  1. Sign in to [Huawei Developer Console] (https://developer.huawei.com/consumer/en/console) and create an AdUnit

Create a custom event on Google AdMob

  1. Sign in to [Mopub console] (https://accounts.smaato.com/)
  2. Go to "**Inventory -> Create a new App"
  3. Under the "Apps" section, click "New Adspace" Give it a label (eg: Huawei Banner) click "Save"
  4. Go to "**Networks -> Create a new Network" and choose Custom SDK Network
  5. Click New Line Item for add mediation
  6. Enter the **Class Name and Method Name ** and Custom Data according to the type of your Ad. Refer to the section below.

Custom event class

Ad Type Custom event class
Banner Ad com.hmsmd.huawei.ads.CustomMediationBanner
Interstitial Ad com.hmsmd.huawei.ads.CustomMediationIntersitial

Custom Event Parameters

{"AD_UNIT_ID":"testw6vs28auh3"}

Method Names

loadCustomBanner
loadCustomIntersitial

Integrate the Huawei Mediation SDK

Note : A device with Huawei Mobile Services (HMS) installed is required

In the project-level build.gradle, include Huawei's Maven repository.

repositories {
    google()
    jcenter() // Also, make sure jcenter() is included
    maven { url 'https://developer.huawei.com/repo/' } // Add this line
}

...

allprojects {
    repositories {
        google()
        jcenter() // Also, make sure jcenter() is included
        maven { url 'https://developer.huawei.com/repo/' } //Add this line
    }
}

In the app-level build.gradle, include Huawei Ads dependency (required by the adapter) and the adapter

dependencies {
    implementation 'com.huawei.hms:ads-lite:13.4.37.300'
    implementation 'com.hmsmd.huawei.ads:androidlibrary:1.0.4'
}
  1. Generate a keystore file

  2. Place the keystore file in the app directory

  3. Modify the app module build.gradle file - update the signingConfigs to your keystore's setting

  4. Build the project or run the app in your device / emulator

Important: To add Huawei Ads Kit SDK and Mediation adapter, the native project should be opened with Android Studio.

Platforms

Native

This section demonstrates how to use Smaato mediation feature with Huawei Ads Kit on Native android app.

Firstly, integrate the Smaato SDK for Android

Smaato Android SDK can be used for all ad types.

Note : Developers can find app level build.gradle in their project from "app-folder/app/build.gradle"

Banner Ad

To use Banner ads in Native android apps, please check the Smaato SDK. Click here to get more information about Smaato SDKs Banner Ad development.

Interstitial Ad

To use Interstitial ads in Native android apps, please check the Smaato SDK. Click here to get more information about Smaato SDKs Interstitial Ad development.

Sample Codes Based on Ad Types

Banner Ad

<SmaatoBanner
adSize="fullBanner"
BannerView mBanner = new BannerView (context);
mBanner.getAdSettings().setPublisherId(publisherId);
mBanner.getAdSettings().setAdspaceId(adspaceId);} />

Interstitial Ad

interstitial = new Interstitial(this); //'this' is your Context
interstitial.setInterstitialAdListener(interstitialAdListener);
interstitial.getAdSettings().setPublisherId(your_publisher_id);
interstitial.getAdSettings().setAdspaceId(your_adspace_d);

Screenshots

Smaato

Banner Ad

Huawei

Banner Ad

Interstitial Ad