Skip to content

Latest commit

 

History

History
207 lines (141 loc) · 6.88 KB

README.md

File metadata and controls

207 lines (141 loc) · 6.88 KB

Huawei-Smaato Mediation Github Documentation

Latest Version Kotlin
Supported Platforms

Introduction

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

Compatibility

Banner Ad Interstitial Ad
Native (Java/Kotlin)

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 Smaato

  1. Sign in to [Smaato 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.hmscl.huawei.smaato_mediation.CustomMediationBanner
Interstitial Ad com.hmscl.huawei.smaato_mediation.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
    }
}

First, download the "smaato_mediation-v1.0.1.aar" file in the project. Then in Android Studio, after saying File->New->New Module, select Import AAR&JAR. Then select the downloaded aar file

Note : Older versions could be found under the "_releases" folder

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //Adapter SDK
    implementation project(":smaato_mediation-v1.0.1")
    //Huawei Ads Prime
    implementation 'com.huawei.hms:ads-prime:<latest_version>'
}

NOTE: If your app can run only on Huawei mobile phones, you can integrate the Huawei Ads Lite SDK instead of Huawei Ads SDK (Optional)

dependencies {
    ...
    //Huawei Ads Lite
    implementation 'com.huawei.hms:ads-lite:<latest_version>'
    ...
}

Latest version of SDKs

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

Permissions

The HUAWEI Ads SDK (com.huawei.hms:ads) has integrated the required permissions. Therefore, you do not need to apply for these permissions.

android.permission.ACCESS_NETWORK_STATE: Checks whether the current network is available.

android.permission.ACCESS_WIFI_STATE: Obtains the current Wi-Fi connection status and the information about WLAN hotspots.

android.permission.BLUETOOTH: Obtains the statuses of paired Bluetooth devices. (The permission can be removed if not necessary.)

android.permission.CAMERA: Displays AR ads in the Camera app. (The permission can be removed if not necessary.)

android.permission.READ_CALENDAR: Reads calendar events and their subscription statuses. (The permission can be removed if not necessary.)

android.permission.WRITE_CALENDAR: Creates a calendar event when a user clicks the subscription button in an ad. (The permission can be removed if not necessary.)

Version Change History

1.0.1

  • Integration methods of Huawei Ads SDK in the plugin have been changed to compileOnly.
  • Huawei Ads SDK (lite or prime) has to be added externally to the app anymore.

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 :

  1. Developers can find app level build.gradle in their project from "app-folder/app/build.gradle"
  2. If you use native ad format in your application, please submit a ticket here to get support from Huawei.

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