Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiDemoFiremonkey

Admob Interstitials Demo Source Code Using The Android JNI In Delphi XE5 Firemonkey

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Interstitial | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSDeveloper Sadettin Polat wrote in with a link to a demo he wrote which implements AdMob interstitials in Delphi XE5 Firemonkey. The demo is a good demonstration of using the Delphi Android JNI. In previous demos of using Admob with Delphi I’ve only seen banner ads demonstrated. One caveat is that Google Play may no longer be accepting applications with the original Admob SDK in them as of August 1st 2014. Google has a new Admob SDK which is part of the Google Play Services SDK. However, even if you can no longer use the SDK from this demo on Google Play it does give you a great starting point for converting it forward to the new Google Play Services Admob SDK. Google has a migration guide here that shows the differences between the two SDKs. Similar Android JNI code should work in Delphi XE6 and AppMethod. Here is a sample of the type section from the Admob interstitial demo:
type
TInterstitialAdListener = class(TJavaLocal, JAdListener)
public
FParent:TForm;
//    constructor Create(aParent:TForm);
procedure onReceiveAd(ad: JAd); cdecl;
procedure onFailedToReceiveAd(ad: JAd; error: JAdRequest_ErrorCode); cdecl;
procedure onPresentScreen(ad: JAd); cdecl;
procedure onDismissScreen(ad: JAd); cdecl;
procedure onLeaveApplication(ad: JAd); cdecl;
end;

Head over and check out the full source code for the Admob SDK interstitial demo on Github before downloading it.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

1 Comment

Leave a Reply