DelphiWorlds / Kastri

Cross-platform library for Delphi
MIT License
490 stars 118 forks source link

[Admob] Error InterstitialAd #110

Closed zyxel4754 closed 1 year ago

zyxel4754 commented 2 years ago

I have tested Kastri's "Admob" demo. Adding in the code

`...

FIntAd := TInterstitialAd.Create; FIntAd.AdUnitId:='ca-app-pub-xxxxxxxxxxx'; FIntAd.TestMode := false; ... Also I've also added the dw-admob.jar file to the Libraries and changed the AndroidManifest.template.xml file by adding ... <%application-meta-data%> android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxx"/> <%uses-libraries%> ... ` I compile it without problems and when I press the [Interstitial] button I get the following error:

Ad Failed to Load (tInterstitialAd) 3: No ad config

I Using: Delphi 11 Version 28.0.45591.0253 Update 1 Platform: Android 9 Model: Xiaomi Mi A1

DelphiWorlds commented 2 years ago

Assuming you actually added the correct xml (your example is wrong, but it won't compile if it looks like that), if you've only just set up your AdMob it can take a while before the ad unit becomes "active". Please try again in a few hours.

zyxel4754 commented 2 years ago

I copied the code snippet from the Delphi template, after compiling it looks like this:

    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxxxxxx"/>

Everything I said yesterday I have tested it on a device with Android 12 and it works perfectly and you can see the Interstitial in full screen, however today I have tested it again on an Android 9 and it doesn't work, it still gives the error: Ad Failed to Load (tInterstitialAd) 3: No ad config

DelphiWorlds commented 2 years ago

Not sure what is happening with your Android 9 device - I just tried the demo on the Android 9 device I have and it is working OK.

zyxel4754 commented 2 years ago

Ok, so I'll check my Android 9 device and see if I can find out what's going wrong.