In this documentation we explained how to use Huawei-Smaato mediation with in the different platforms.
| | Banner Ad | Interstitial Ad |
- Sign in to [Huawei Developer Console] (https://developer.huawei.com/consumer/en/console) and create an AdUnit
- Sign in to [Mopub console] (https://accounts.smaato.com/)
- Go to "**Inventory -> Create a new App"
- Under the "Apps" section, click "New Adspace" Give it a label (eg: Huawei Banner) click "Save"
- Go to "**Networks -> Create a new Network" and choose Custom SDK Network
- Click New Line Item for add mediation
- Enter the **Class Name and Method Name ** and Custom Data according to the type of your Ad. Refer to the section below.
Ad Type | Custom event class |
---|---|
Banner Ad | com.hmsmd.huawei.ads.CustomMediationBanner |
Interstitial Ad | com.hmsmd.huawei.ads.CustomMediationIntersitial |
{"AD_UNIT_ID":"testw6vs28auh3"}
loadCustomBanner
loadCustomIntersitial
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'
}
-
Generate a keystore file
-
Place the keystore file in the app directory
-
Modify the app module build.gradle file - update the signingConfigs to your keystore's setting
-
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.
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"
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.
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.
<SmaatoBanner
adSize="fullBanner"
BannerView mBanner = new BannerView (context);
mBanner.getAdSettings().setPublisherId(publisherId);
mBanner.getAdSettings().setAdspaceId(adspaceId);} />
interstitial = new Interstitial(this); //'this' is your Context
interstitial.setInterstitialAdListener(interstitialAdListener);
interstitial.getAdSettings().setPublisherId(your_publisher_id);
interstitial.getAdSettings().setAdspaceId(your_adspace_d);
![]() Banner Ad |
![]() Banner Ad |
Interstitial Ad |