Super Heroes App
Introduction
I will introduce you to how to implement Google AdMob Ads via Huawei mediation plugin.
Project Structure
Find Super Hero App is designed with MVVM design pattern.
![]() |
![]() |
Screenshots
![]() Heroes List |
![]() Heroes List |
![]() Hero Detail |
![]() Hero Photo |
About Google AdMob
Google AdMob makes it easy for developers to earn money from their mobile apps with high-quality ads. AdMob maximizes the value of every impression by combining global advertiser demand, innovative ad formats, and advanced app monetization technology. For more detail
About Huawei Ads Kit
Ads Kit leverages the vast user base of Huawei devices and Huawei's extensive data capabilities to provide you with the Publisher Service, helping you monetize traffic. Meanwhile, it provides the advertising service for advertisers to deliver personalized campaigns or commercial ads to Huawei device users. For more detail
About Huawei-Admob Mediation Plugin
You can use the Huawei-AdMob Mediation Plugin to increase your advertising revenue by just adding the implementation lines without making any changes to the code. For more detail
How To Build?
Modify AndroidManifest file
Replace your AdMob app ID (identified in the AdMob UI) on the app's AndroidManifest.xml file. To do so, add a tag with android:name="com.google.android.gms.ads.APPLICATION_ID". You can find your app ID in the AdMob UI.
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
Prepare mediation on AdMob platform
You can follow the steps here to prepare mediation on the Admob platform.
Modify the AdMob ad type ids
You need to replace the lines in the Constant file with your mediated AdMob IDs.
object Constants {
object AdIds {
const val ID_LIVE_BANNER = "ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy"
const val ID_LIVE_INTERSTITIAL = "ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy"
const val ID_LIVE_REWARDED = "ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy"
const val ID_LIVE_NATIVE = "ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy"
}
}
Also, you need to replace the ID in the AdView component in activity_main.xml file.
<RelativeLayout >
<com.google.android.gms.ads.AdView
...
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy" />
</RelativeLayout>