AdMob Support And Mediation

File: JVE.AdMob.pas Inheritance: TControl ⬅ TJVEBanners ⬅ TJVEAdMob

File: JVE.Facebook.pas Inheritance: TControl ⬅ TJVEBanners ⬅ TJVEFacebookBanner

These controls can integrate the Google AdMob SDK or Facebook Audience Network into your application. AdMob SDK can present paid AdMob and other ads (ads by other vendors are presented through its mediation service); see site for details. Audience Network can present paid Facebook ads; see

AdMob and Facebook SDKs are only available on iOS and Android platforms; these controls inherits from TJVEBanners thus when the SDK is not available (or when there are no ads to show), it will fallback to in-house ads and cross-promos, supplied by the TJVEBanners normal functionality.

This control inherits from TJVEBanners, so this section will not cover inherited properties (see Banners and Interstitials section, Presenting Banners subsection, instead). The following properties are exposed by this control:


  • AndroidUnitId, iPadUnitId and iPhoneUnitId – the Ad Unit ID or Mediation ID, as provided by the AdMob service. Due to AdMob requirements you should have separate iPad and iPhone IDs (the control will automatically choose the correct one for you).
  • AndroidPlacementId, iPadPlacementId and iPhonePlacementId – the ad Placement ID, as provided by the Audience Network service.
  • AdDelay – the time before actual ads are requested from the AdMob server (if fallback banners are available).

The following properties are only available for AdMob ads:

  • AutoSize – AdMob SDK prescribes a particular height for this control. Set to True to have the control set its height as needed.
  • UserGender – providing (expected) user details generally allows for better ad matches, resulting in a higher click-through-rate and, in the end, higher revenues. If gender is known, set it here.
  • UserAgeYears – set this field to the estimated age of the user.
  • UserKeywords – any currently valid keywords, identifying the app and/or your user can be set here.
  • UserLocation – if the current location of the user is known, it can be provided in this public (not published) property.


This control provides no new methods, but it exposes two further events (beyond the one, exposed by TJVEBanners), as follows:

  • OnHasPaidAd – this event is called the moment an ad is successfully retrieved from the AdMob server and shown.
  • OnNoPaidAd – this event is called when there are no ads available (for example if there is no valid ads for the user or if there is no internet connectivity). An error message, returned by the AdMob SDK, is passed to this event for reference. You should not normally present this error.

You can use the above two events, if you don’t want to use the fallback banners. You can then show the control in the first event and hide it in the second (and reclaim the screen real-estate appropriately).


It usually takes a couple of seconds for the component to bring the very first ad, so if AdDelay value is 0 and there is a fallback banner, that fallback might be presented for just 2 seconds: too short to react and too distracting.

Since this control normally sets its own height, its best placement is aligned to bottom on your form, with the remaining user interface within a separate TLayout, aligned to client. See control’s source code’s comments for details on the exact height that will be used.


AdMob SDK support showing other ad networks’ ads through a free mediation mechanism (see AdMob website for details). This component suite has support for iAd mediation included and installed (Apple’s ad service for iOS). You can install other mediation layers as needed (see JVE.AdMob.pas file for details and explanations).

To configure AdMob mediation (i.e. specify which networks’ ads will be presented with what frequencies and where) you will have to go to the AdMob website. These issues are beyond what this component attempts to expose.


Example presentation of an actual ad, delivered by the AdMob service, on iPad device, might look as follows: