Easily Add Advertising To Your Apps With Delphi XE6 Firemonkey On Android And IOS


Marco Cantu from Embarcadero has a blog post up where he shows how simple it is to use the new TBannerAd component for Delphi XE6 Firemonkey. TBannerAd wraps the AdMob API for Android and the Iad API for IOS so it is cross platform which means you can use one component and it works on both platforms. It may actually be harder to setup the account information that you need to be able to use AdMob and IOS than it is to actually implement the ads within your app. Using the component is as simple as setting the AdUnitID property and calling the LoadAd method. It also appears that TBannerAd has a TestMode property which corresponds to the TestMode option in the Android SDK. There is more information about the TBannerAd functionality over in the XE6 documentation called Adding Advertising To Your Mobile Apps. Keep in mind that TBannerAd looks like it really only implements a standard banner and doesn’t support interstitials that I can see. Interstitials are where the money is at in my experience so you will need to get a third party library to implement that in your app. The last thing you need to get the banner ads running on Android is to add a com.google.ads.AdActivity section to your Android manifest. It should look like this:
<activity android:name=”com.google.ads.AdActivity” android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize”/>
And finally a tip from the Embarcadero Firemonkey forum concerning an error you may receive from TBannerAd on IOS. If you get this error: “ObjectiveC-class ADBannerView not found” then “You have to add “-framework iAd” to the LD Linker commands in the project-options.” according to Oliver S.
Update: Marco has another blog post here where he talks about the Linker issue. He recommends adding iAd and StoreKit like this “-framework iAd -framework StoreKit”.
Head over and read the full blog post from Marco Cantu where he demonstrates TBannerAd In Delphi XE6.

Comments are closed.