Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


The AdMobBanner item allows monetizing your app with banner ads on Android and iOS. More...

Import Statement: import Felgo 4.0




Detailed Description

Ad banners can be used to display ads within your app without distracting your user from the app's main functionality. If you just want to include simple banner ads into your apps, Smart Banners are probably the right thing for you. They are versatile, support all device types and sizes and are really easy to use, see Example Usage for a simple example.

 import Felgo

 App {
   NavigationStack {
     AppPage {
       title: "Admob Banner"

       AdMobBanner {
         adUnitId: "ca-app-pub-3940256099942544/6300978111" // banner test ad by AdMob
         testDeviceIds: [ "<a testdevice id>" ]
         banner: AdMobBanner.Smart

         anchors.horizontalCenter: parent.horizontalCenter
         anchors.top: parent.top

AdMob also offers a range of different-sized banners, which you can incorporate into your apps and games. Please note that some of the available sizes can only be used on tablets due to their dimensions.

Banners get only loaded if the QML item is visible, meaning that its visible property is not set to false and all its parent items are visible too.

If AdMobBanner.Smart is set as banner type the banner will automatically resize to the full width on screen orientation changes.

The actual ad view is displayed as a view native to the platform, which always makes it appear on top of all other QML items, disregarding the z property. If you want to display another QML item above the ad at some point, make sure to set the ad's visible property to false, otherwise it would still be hidden behind the ad view.

You can also use the newer AdMobBannerNative type to embed the ad banner directly inside the QML UI.

For more information also have a look at AdMob Plugin.

See also AdMobBannerNative.

Property Documentation

adUnitId : string

Provide your Ad unit ID retrieved from the AdMob console in the format ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx here. If you do not have an AdMob account yet, you can create a new one at http://www.google.com/ads/admob/. Once you are logged in, you can acquire a new Ad unit ID by creating a new app and defining a new ad unit.

This enum type defines what kind of banner should be displayed.

  • AdMobBanner.Standard - A standard banner of size 320 x 50
  • AdMobBanner.Large - A large banner of size 320x100
  • AdMobBanner.Medium - A medium rectangle banner of size 300x250
  • AdMobBanner.LeaderBoard - A leaderboard-sized banner of size 728x90
  • AdMobBanner.Smart - A auto-resizing smart banner (recommended)

The default banner is AdMobBanner.Smart.

Note: Please keep in mind that some banners might be too large for displaying on some devices and therefore won't be displayed. It's recommended to use the AdMobBanner.Smart banner size for apps targeted for multiple device types.

childDirectedTreatment : bool

Set this property to true if you want to indicate that you want Google to treat your content as child-directed. Google will then take steps to disable IBA and remarketing ads for your ads.

More information can also be found here.

[since Felgo 3.9.0] requestAdTrackingAuthorization : bool

Set this property to true to automatically request ad tracking authorization on iOS.

The item will ask the user for permission to use the advertising identifier (IDFA) before showing any ad. If the user accepts, ads may be attributed to the user and thus perform better.

The item still shows the ad even if the user denies the request.

To support the ad tracking authorization, adapt your ios/Project-Info.plist. Add the NSUserTrackingUsageDescription key with a description of usage. Example:

 <string>This identifier will be used to deliver personalized ads to you.</string>

You can find more information here.

Note: This property only has an effect on iOS and is ignored on other platforms.

This property was introduced in Felgo 3.9.0.

testDeviceIds : list<string>

Provide your device id as an array of string values here to receive test ads for the specific test devices.

Note: If you test your application with live ads frequently, Google might ban your account for fraud. Therefore if you are not able to provide the testDeviceIds and test with live ads instead, make sure not display the AdMob item everytime you test your app on your device.

You can find your testDeviceIds in the device log after you first run an your app with integrated AdMob plugin, search for "To get test ads on this device, call adRequest.addTestDevice".

Signal Documentation


This handler is called when the application was moved to background to display an ad e.g. in the browser and the user returns from the browser.

Note: The corresponding handler is onAdClosed.


This handler is called either because of a network error or when an ad should be displayed, but AdMob can't find an ad that fits your application. A possible reason for this can be the filter settings in your AdMob account, or that AdMob does not have any related ads in your country.

Note: The corresponding handler is onAdFailedToReceive.


This handler is called when a banner is clicked and e.g. a new browser window will be opened by the ad soon.

Note: The corresponding handler is onAdOpened.

See also AdMobBanner::adLeftApplication.


This handler is called as soon as the requested ad is loaded and displayed on the screen.

Note: The corresponding handler is onAdReceived.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded