👨🏼‍💻How to use Huawei Ads with AddApptr Mediation (Native Android)?

Oğuzhan Kalkar
Huawei Developers
Published in
5 min readDec 23, 2022

--

AddApptr
AddApptr Platform

Introduction

Hello, today I will be talking about Mediation as general and also I will specifically investigate Huawei Ads with AddApptr mediation in Native Android detailly. I will mention both AddApptr Dashboard and Android part to create an understanding. Lets Begin! 🎉

Ad mediation is the process of cooperating with different ad networks to find the most available ads in order to fill ad slots with more profitable and personalized adverts. AddApptr’s mission is to generate maximum advertising revenues for our app publishers and developers, while offering maximum service and tech support. We are dedicated to making life easier for our publishers.

Huawei Ads

As for Huawei, the Huawei alone shipped 240.6 million smartphones in 2019(source) ; as a result, Huawei’s market stands out to us as one with a significant user base and enormous potential. It is obvious that using Huawei Ads will improve revenue for publishers or developers.

If you want to use AddApptr, you could use its custom mediation feature to add Huawei Ads as one of your Ad sources to maximize your profit in your Android application.

In this article you will learn how to use AddApptr mediation to display Huawei Ads in Native Android step by step.

Test ad IDs will be used in this article. If you want to use your own ads, sign in to your Huawei Developer Console and create an AdUnit.

Add your app in Apps section

Go to AddApptr Dashboard and login with your AddApptr account.

On the Dashboard, you will see Add App at the top right of the screen, click to start adding an App.

Apps Page of AddApptr

Fill the necessary information about your application and click Add App.

Add App page with details filled.

Add a Placement

On the AddApptr Dashboard, go to Placements page and click on Add Placement on top right

Add Placement page of AddApptr

Fill the necessary information in Add Placement screen.

Add Placement with details filled

After completing, you can see your Placement added

AddApptr new placement added

Add Network Key for Android

On the AddApptr interface, go to Network Keys page and click on Add Network Key on top right

Add Network Key page of AddApptr

Select your application and create a Shorthand.

Add Network Key for Android
Define a shorthand

Click on Add a custom key on the Add Network Key for Android page

Add a custom key on Add Network Key page

Fill the necessary fields in Add a custom key page.

Add a custom key with details filled

After adding the custom key, users can see the custom key below Huawei title and add the network key. In this case, it is a test ID. Click save when completed.

Add Network Key for Android page

Add your application to a group on App Settings page

On the AddApptr interface, go to App Settings page and add your application to one of the groups. You can do this according to the Ad types specified at top right.

App Settings page of AddApptr

Click on the + sign in the groups and add your application. Fill the necessary places accordingly

Add Rule page of AddApptr

The process is completed. You can continue with the Android part.

App Settings page successful operation

On your application

In the project-level build.gradle, include Huawei’s and AddApptr’s Maven repository

build.gradle

Add the following lines inside dependencies{} bracelets in /app/src/build.gradle file

build.gradle

It is highly recommended to enable AndroidX in your project. Editing gradle.properties file and adding the lines below(if they are not present) is required for most ad-network sdks.

gradle.properties

Some ad networks might not work correctly because of cleartext HTTP traffic being disabled by default in Android 9. To make them work you need to enable cleartext traffic, for example by adding declaration in Manifest.xml like:

AndroidManifest.xml

(Optional) Set location permissions in AndroidManifest.xml

AndroidManifest.xml

Define your application name in AndroidManifest.xml

AndroidManifest.xml

Initialize AATKit in MyApplication.onCreate() method. Setting of delegate is optional, but if you would like to obtain notifications about AATKit events you will need to implement the AATKit.Delegate interface.

MyApplication.java

Note: By default initializing AATKit will also enable so called shake-debug screen — special dialog with debugging information (like AATKit version and loaded ads) — after shaking the device. If you would like to disable this screen (for example when your application is a accelerometer controlled game), you can disable it in AATKitConfiguration, with code becoming:

MyApplication.java

But please keep in mind that, for most applications, it is advised to keep the debug screen enabled

Notify AATKit about MyActivity events

MyActivity.java

After completing this configurations, the mediation will be completed successfully.

For more information regarding Huawei Ads, refer to the official documentation here.

For more information regarding AddApptr mediation, refer to the official documentation here

Conclusion

To sum up, today I discussed mediation in general and looked closely into Huawei Ads using AddApptr mediation in Native Android. I brought up both the AddApptr Dashboard and the Android part to help people understand mediation and how it is used. See you later! 👋

References

--

--