AdMob Manager is a sample project that demonstrates how to integrate Google AdMob ads into a Qt Android Application using native Java code and the QJniObject class. This project supports both Banner Ads and Interstitial Ads, allowing seamless ad display management directly from C++ code.
Download all the content and open the content in QT Creator.
Select the Kit -
-
for Android Emulator.
Adnroid Qt6.8.0 Clang x86_64
-
for Android Device.
Adnroid Qt6.8.0 Clang arm64-v8a
-
You need to update AndroidManifest.xml with your app id.
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/>
-
You need to update the BannerAd id and Interstitial ad Id in admobbridge.cpp with your own ids.
QString bannerAdId = "ca-app-pub-3940256099942544/6300978111"; QString interstitialAdId = "ca-app-pub-3940256099942544/1033173712";
-
Update the build.gradle file with below information.
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'androidx.core:core:1.13.1' implementation 'com.google.android.gms:play-services-ads:23.1.0' implementation 'com.google.firebase:firebase-ads:23.1.0' }
-
replace google-services.json in android/src directory with your own json file.