I will introduce you to how to implement Google AdMob Ads via Huawei mediation plugin.
Find Super Hero App is designed with MVVM design pattern.
Heroes List |
Heroes List |
Hero Detail |
Hero Photo |
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
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
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
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>
You can follow the steps here to prepare mediation on the Admob platform.
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>