Open DevonBernard opened 4 years ago
I am facing a similar issue where my Ads are not showing up when installed in Android Device. I was getting Test Ads and after updating the APP ID and Unit ID with my Google Admob details, i am not seeing the Banner Ad anymore in my App.
In Android Studio i am getting the following: 2020-06-05 15:32:40.440 17070-17070/io.ionic.starter V/Capacitor/AdMob: Notifying listeners for event onAdFailedToLoad 2020-06-05 15:32:40.441 17070-17070/io.ionic.starter D/Capacitor/AdMob: No listeners found for event onAdFailedToLoad
I followed the guide, everything works great on iOS.
However, when I run on Android I get strange results.
When running Android Studio in an emulator, I see "Test Ad", no matter what appId or adId I pass (I even tried overriding the default values in (/project/client/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java).
When running Android Studio on a real device, I see nothing. Both promises of
AdMob.initialize()
andAdMob.showBanner()
execute and resolve, but theonAdLoaded
listener is never fired. Note, this listener is fired in the emulator, but just not the physical device.I don't understand why the emulator or device would be acting differently. Any Advice?
As for Android setup, I added
add(AdMob.class);
to (/project/client/android/app/src/main/java/com/my-project/client/MainActivity.java) andto
/project/client/android/app/src/main/AndroidManifest.xml
Given I always see the test-ad or no add, I suspect this meta field isn't actually being picked up, nor the appId or adId set in the React app.
This could maybe also be from when I installed the capacitor-admob plugin, it didn't compile out-of-box. I had to adjust
(/project/client/node_modules/capacitor-admob/android/src/main/java/app/xplatform/capacitor/plugins/AdMob.java)
and replaceimport android.support.design.widget.CoordinatorLayout;
withimport androidx.coordinatorlayout.widget.CoordinatorLayout;
since that dependency was missing and I run AndroidX.Thank you for this plugin! Doing this myself would've been a much bigger hassle. 👍Any help with this would be greatly appreciated.