👨🏼‍💻How to Integrate Huawei Ads Adapter of OpenMediation to a Native Android Project

Sena Zincircioğlu
Huawei Developers
Published in
7 min readDec 8, 2022

--

Huawei Ads

Introduction

Hello everyone,

In this article we will talk about how to perform ad mediation using Android SDK and Huawei Ads adapter of OpenMediation.

Before moving on to the integration steps, let’s take a look at the concept of “Mediation” and OpenMediation platform.

What is ad meditation?

Ad Mediation gives multiple ad networks access to your ad inventory, and gets them to compete against each other for ad slots. This process increases competition among advertisers and in return, increases your ad revenue. The mediation platform checks what CPM all the various ad networks are offering and looks for the highest one.

OpenMediation

OpenMediation is a third party platform for mobile App developers focusing on user lifecycle management and enabling them to monetize the App. In other word, OpenMediation is a fully open mediation platform, providing an end-to-end system from SDK to server, Dashboard, and datacentre.

Currently, OpenMediation supports following ad formats:

  • Banner
  • Native
  • Interstitial
  • Rewarded

Integration Process of Huawei Ads Adapter of OpenMediation

Now, we can start to talk about the integration process of Huawei Ads and OpenMediation SDK through mediation. This process includes 3 parts :

  1. Configurations on Huawei Ads Console
  2. Configurations on OpenMediation Dashboard
  3. Development Process on Source Code

1. Configurations on Huawei Ads Console

In Huawei Ads platform, all we need to do is creating ad units of ad formats we want to use and keeping the ad unit IDs to use for next operations.

For details about creating ad unit in Huawei Ads Platform you can refer to this link.

2.Configurations on OpenMediation Dashboard

We need to register on OpenMediation platform in order to access Dashboard. You can create an account with using this link.

After registration process, we will follow the steps below:

  • Creating App in OpenMediation Console
  • Adding and Managing Ad Placement
  • Configuration of Ad Instance for Ad Placement
  • Setting Mediation Rule

Creating App in OpenMediation Console

Log in to OpenMediation Dashboard and navigate to the Overview interface. You will see Add App at the top of the application list, click to start adding an APP.

OpenMediation Dashboard Overview

First, select your app’s platform and indicate if your App is listed in a supported app store.

App Info Window

If your app is listed in the store, please find your app on the selected Store.

Adding Store Link of App

For details about creating app in OpenMediation Dashboard please refer to Adding apps document in Open Mediation Help Center.

Adding and Managing Ad Placement

The placement needs to match the added application, and you need to select the corresponding app in the application list of Overview. After entering Monetize, click Setup, click placement in the navigation bar, and click Add Placement to add placement

Placements Tab

After customizing the name of the placement in the Name column, select the ad type you want and click Save on the top of the page.

Adding Ad Placement

In the Operations section, you can control the status of each placements, Enable or Disable

Enable/Disable Ad Placements

Note :

Only one rewarded and interstitial placement is allowed to be created in the OpenMediation platform. Multi-ad scene requirements can be implemented by automatically calling logic and scene functions through the OpenMediation SDK.So, after perfom the adding placement steps for Rewarded and Interstitial Ads, you can also add Placement Scenes for them.

Scenes Options for Rewarded and Interstitial

You can refer the Ad Placement and Scenes documents in OpenMediation Help Center for detail information.

Configuration of Ad Instance for Ad Placement

Click on Mediation in the left navigation bar Setup to go to the monetize function page.

Mediation Tab

Select the placement that needs to be configured, and click +Add Instance in the instance sub-interface to configure instance information.

Adding Instance for the Placement

You can get the ad network drop-down menu by clicking on the Ad Network, and then click “Huawei” to select Huawei as an ad network.

Selection Ad Network

When you click on the ad network list to select Huawei Ads, you’ll see a list of instance additions, which you can start configuring by clicking on .

Creating Ad Instance Step 1

Configure Basic Information of Instances.

Creating Ad Instance Step 2

Note that, Unit ID must be same with the ID you got from Huawei Ads Platform

You can configure eCPM for ad instance manually.

Creating Ad Instance Step 3

Don’t forget enabling the instances.

Enable/Disable Ad Instances

You can refer the Ad Instance documents in OpenMediation Help Center for detail information.

Setting Mediation Rule

In the Setup>Mediation Tab, select the placement that needs to be configured, and click +Add Mediation Rule in the Mediation Rule sub-interface to configure mediation rule.

Adding Mediation Rule

Enter basic information.

Basic Information of Mediation Rule

Click “Advanced Options”.

Adding Advanced Options for Mediation Rule

Enter Advanced Options information.

Advanced Options Fields

Enable Mediation rule.

Enable/Disable Mediation Rule

You can refer the Mediation Rule Settings documents in OpenMediation Help Center for detail information.

3. Development Process on Source Code

After performing console operations for Huawei Ads and OpenMediation, we need to add some dependency to our project. First, please add the following maven URLs to your project-level build.gradle file.

Then, add the following to in dependencies section of your application-level build.gradle file.

You must add the following to your Proguard configuration file (Android Studio: proguard-rules.pro or Eclipse: proguard-project.txt) if you are using Porguard in your application. Failed to do so will lead to errors.

Note:

The stages mentioned after this section were prepared for developers who do not have any Openmediation Integration in their project. If you have completed the Openmediation Android SDK Development Steps before, you can skip the rest of this section.

Initialization OpenMediation SDK

Before you can fetch ads from OpenMediation Platform, you should first initialize the OpenMediation SDK when your app started. To do so, we suggest to call OpenMediation SDK’s init() method within onCreate() of an Application or Activity as below:

Note : APP KEY can only be obtained by creating apps on OpenMediation

After performing all of operations mentioned above, you can start to develop ad units.

  • Banner Ad

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

  • Interstitial Ad

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

  • Rewarded Video Ad

To use Rewarded Video ads in Native android apps, please check the OpenMediation Mediation SDK. Click here to get more information about OpenMediation Mediation SDKs Rewarded Ad development.

  • Native Ads

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

Conclusion

  • You can perform Ad Mediation with using Huawei Ads and OpenMediation Platforms.
  • The integration process of the Huawei Ads Adapter for OpenMediation SDK consists of several console operations on both the Huawei Ads side and the OpenMediation side and some development steps on source code.
  • If you want to browse the Huawei Ads Adapter source code you can also refer to this link.

--

--