0
votes

TBannerAd can't load via LoadAd in Delphi 10.2 Tokyo - Firemonkey Android.

Uses Permissions - OK

Access network state

Internet

AdMob Service = True for Project/Options/Entitlement List - OK

AdUnitID - OK

procedure TForm1.FormCreate(Sender: TObject);
begin
BannerAd1.AdUnitID:='ca-app-pub-3940256099942544/6300978111';
// AdMob Banner Sample ad unit ID
// Also I tried for my real AdUnitID
end;

My sample code for to try - OK

procedure TForm1.Button1Click(Sender: TObject);
begin
BannerAd1.LoadAd; 
end;

I used AdMob for my old project in different Delphi version.

There didn't any problem for this.

But, my application is freezing for a time and TBannerAd can't load via LoadAd for this project.

Log monitor is giving this error for this problem.

The Google Play services resources were not found.

Check your project configuration to ensure that the resources are included.

1
The AdUnitID and the LoadAd should go together inside the FormShow event. Check if this (prntscr.com/h0zklz) is enabled and under Project > Options > Entitlement List be sure that AdMob service is active!Alberto Miola
Also be sure that you've downloaded witht he SDK manager the needed toolsAlberto Miola
Dear Albert Miola, I tried FormShow event for together, There is google-play-service.dex.jar in Android Libraries Node, Project > Options > Entitlement List - AdMob service is active and installed Google Play services and others for Android SDK manager. But problem is continuing.moorker

1 Answers

0
votes

I am using Delphi 10.3 and for Admob to work i have added a new meta-data tag with my Admob App Id into AndroidManifest.template.xml :

<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
    ......>
        ...
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-################~##########" /> 
....

I hope it could fix your problem.