Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Otros temas > Trucos
Register FAQ Members List Calendar Guía de estilo Today's Posts

Los mejores trucos

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 28/10/2025
dani36652 dani36652 is offline
Miembro
 
Join Date: Apr 2019
Posts: 78
Poder: 8
dani36652 Va camino a la fama
Smile Android: Anuncios Intersticiales de forma Nativa con Delphi

Hola qué tal estimados.
El día de hoy les traigo este ejemplo de cómo implementar anuncios intersticiales de Google Admob de manera nativa en Android con Delphi.

La idea es simple, se usa una librería aar con toda la lógica nativa y desde delphi solo se usan poquitas lineas de código para hacer uso de los anuncios, ejemplo:
Código Delphi [-]
unit UMain;

interface

uses
  UInterstitialAd,
  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;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    procedure OnAdLoaded;
    procedure OnAdFailed(const ErrorMessage: string);
    procedure OnAdClosed;
  public
    { Public declarations }
    FInterstitialAd: TInterstitialAd;
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.FormCreate(Sender: TObject);
begin
  FInterstitialAd:= TInterstitialAd.Create(Self);
  FInterstitialAd.OnAdLoaded:= OnAdLoaded;
  FInterstitialAd.OnAdFailed:= OnAdFailed;
  FInterstitialAd.OnAdClosed:= OnAdClosed;
  FInterstitialAd.TestMode:= True;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  FInterstitialAd.Show;
end;

procedure TForm1.OnAdClosed;
begin
  Label1.Text:= 'Interstitial Ad Closed';
end;

procedure TForm1.OnAdFailed(const ErrorMessage: string);
begin
  Label1.Text:= 'Interstitial Ad Load Failed: ' + ErrorMessage;
end;

procedure TForm1.OnAdLoaded;
begin
  Label1.Text:= 'Interstitial Ad Loaded';
end;

end.

Como pueden ver, solo hay que crear el objeto, mostrar su anuncio e incluso es posible acceder a sus eventos.

El repositorio con las unidades necesarias y un ejemplo está en el siguiente link: https://github.com/dani36652/Delphi-...tialAd-Example
Reply With Quote
  #2  
Old 29/10/2025
Neftali [Germán.Estévez]'s Avatar
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is online now
[becario]
 
Join Date: Jul 2004
Location: Barcelona - España
Posts: 19,474
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto

Gracias por el código.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Reply With Quote
  #3  
Old 03/11/2025
ElKurgan's Avatar
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Join Date: Nov 2005
Posts: 1,243
Poder: 22
ElKurgan Va camino a la fama
Thumbs up

Muchas gracias por el aporte

Saludos
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enviar Email de forma nativa desde IOS krilian Desarrollo en Delphi para iOS/OSX 2 29/01/2025 16:48
Uso de JAlertDialog (Alerta de Diálogo Nativa de Android) dani36652 Desarrollo en Delphi para Android 0 26/08/2020 01:46
Programación de Android de forma "super visual" rrf Noticias 3 15/07/2010 06:11
Pasar Variables de Forma a Forma con delphi.net ASP ASAPLTDA .NET 5 05/07/2007 20:51
Como Pasar Variables de Forma a Forma con delphi.net ASP ASAPLTDA Internet 2 02/07/2007 16:26


All times are GMT +2. The time now is 08:51.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi