Forums

OverviewV-Play 1 SupportAdMob plugin usage › Reply To: AdMob plugin usage

OverviewV-Play 1 SupportAdMob plugin usage › Reply To: AdMob plugin usage
#5767

Christian
V-Play Team

Hi Raimonds,

the problem is, that on platforms where admob is not supported (i.e. all platforms except iOS and Android), the enum cannot be resolved. You can do the following to resolve this issue when you test your game on the desktop:

a.) Add a conditional binding to use the AdMob enum, i.e. use this:

banner: system.desktopPlatform ? 0 : AdMob.Smart

 

b.) Only load the AdMob item on platforms where it is supported with a Loader. Like in the following example:

Loader {
  sourceComponent: system.desktopPlatform ? undefined : admobComponent
}

Component {
  id: admobComponent
  AdMob {
    // your admob code goes here
    banner: AdMob.Smart
  }
}

 

EDIT: Option (b) does not work with AdMob Smart banners, except the Loader is anchored to the top left corner of the gameWindowAnchorItem. In every other case, the AdMob item will be created slightly off screen by the loader and then repositioned. Between creating and repositioning, the Ad tries to show up, and since it’s not fully on screen, the AdMob SDK blocks all Ads. However, this problem only appears when the Component you load is only an AdMob item. Using the Loader item to load Scenes with AdMob items in it is no problem!

Cheers, Chris

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support