Jump to content
Haai5

BannerAd doesn't load

Recommended Posts

When creating the example app for showing a TBannerAd is in http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_AdMob_Service ,

it takes a long time before the form is opened, and no banner is shown. I have made my app exactly as in the example, except for my own BannerAd1.AdUnitID.

Yes, I have set Project | Options | Application | Entitlement List | AdMob service to TRUE, and yes, I do have internet access.

What am I missing?

 

Embarcadero® Delphi 10.3 Community Edition for target Android 64bit.

Share this post


Link to post

I add some screen shots and the code. I think I did all I had to do as the example indicates?

unit BannerAdTestUnit;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Advertising;

type
  TForm1 = class(TForm)
    BannerAd1: TBannerAd;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure BannerAd1ActionCanBegin(Sender: TObject;
      var WillLeaveApplication: Boolean);
    procedure BannerAd1ActionDidFinish(Sender: TObject);
  private
    { Private declarations }
    ActionBeginDate: TDateTime;
    WastedSeconds: Integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

uses System.DateUtils;

procedure TForm1.BannerAd1ActionCanBegin(Sender: TObject;
  var WillLeaveApplication: Boolean);
begin
  ActionBeginDate := Now;
end;

procedure TForm1.BannerAd1ActionDidFinish(Sender: TObject);
var
  Seconds: Integer;
begin
  Seconds := SecondsBetween(ActionBeginDate, Now);
  WastedSeconds := WastedSeconds + Seconds;
  Label1.Text := IntToStr(WastedSeconds) + ' seconds wasted watching ads so far.'
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  if BannerAd1.AdUnitID = '' then
    BannerAd1.AdUnitID := 'ca-app-pub-3004682421148914~2744794599' ;
  BannerAd1.LoadAd
end;

end.

 

BannerAd1.png

Permissions.png

Project Options.png

Screenshot_20210505_112833_com.embarcadero.BannerAdTest.jpg

Edited by Haai5

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×