marcojak / MauiMTAdmob

MIT License
110 stars 18 forks source link

LoadInterstitial does not call OnInterstitialLoaded on Android 8, 9, 10 or 11 #102

Open Ktastic93 opened 1 week ago

Ktastic93 commented 1 week ago

Version of Plugin.MauiMTAdmob: 1.6.4

Problem: When I call “LoadInterstitial” on a device/emulator with Android 8, 9, 10 or 11, neither the event “OnInterstitialLoaded” nor “OnInterstitialFailedToLoad” is called. It works on Android 13 and 14. I'm using .NET 8.

Steps to reproduce the behavior: CrossMauiMTAdmob.Current.OnInterstitialLoaded += Current_OnInterstitialLoaded; CrossMauiMTAdmob.Current.OnInterstitialClosed += Current_OnInterstitialClosed; CrossMauiMTAdmob.Current.OnInterstitialFailedToLoad += Current_OnInterstitialFailedToLoad; CrossMauiMTAdmob.Current.OnInterstitialFailedToShow += Current_OnInterstitialFailedToShow; CrossMauiMTAdmob.Current.LoadInterstitial("ca-app-pub-3940256099942544/1033173712");

private void Current_OnInterstitialLoaded(object? sender, EventArgs eventArgs) { CrossMauiMTAdmob.Current.ShowInterstitial(); }

Devices: Android Emulators using Android 8, 9, 10 and 11.

Output from Android 11 emulator: [Ads] Starting ad request. [Ads] SDK version: afma-sdk-a-v201004999.241199000.1 [Ads] This request is sent from a test device. [Ads] Invoke Firebase method getInstance error. [Ads] The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date [Ads] JS: The jsLoaded GMSG has been sent (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html:792) [chromium] [INFO:CONSOLE(792)] "The jsLoaded GMSG has been sent", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (792) [Ads] Scheduling ad refresh 70000 milliseconds from now. [DynamiteModule] Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21400 [DynamiteModule] Selected remote version of com.google.android.gms.ads.dynamite, version >= 21400 [DynamiteModule] Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21400 [DynamiteModule] Selected remote version of com.google.android.gms.ads.dynamite, version >= 21400

Notes: Rewarded ads work as expected. CrossMauiMTAdmob.Current.LoadRewarded("ca-app-pub-3940256099942544/5224354917", new MTRewardedAdOptions());

marcojak commented 6 days ago

I"ve seen it happening with the emulator. I haven't tried with an actual phone yet so I cannot confirm if it works as expected or not. If anyone could test on an actual phone, that would help

marcojak commented 6 days ago

I've done few additional tests and the issue is with the simulator rather than the API version.

I've tried to create a pixel 5 and pixel 7 pro emulators both with API 30. It didn't work on the pixel 5 but it worked on the pixel 7. At this point I think it's something related to the emulators and I'm not going to investigate it further unless someone finds the issue on an actual phone.

I'll keep it open for a bit to give the opportunity to add comments or findings.

Ktastic93 commented 5 days ago

Thanks for checking.

I also tried it with a few other emulators. When I use emulators (like “Pixel 8 (+ Store)”) with “Google Play” and add the NuGet package “Xamarin.GooglePlayServices.Ads”, then the “Interstitial” ads are displayed.

Since I don't have a device with an older Android version, I can't try it with a real device.