Forums

OverviewV-Play 1 Supporthide/show Admob banner › Reply To: hide/show Admob banner

OverviewV-Play 1 Supporthide/show Admob banner › Reply To: hide/show Admob banner
#7281

Mathias

Okay, I have tried a few different variants now, and here is my experience so far.
1.

    AdMob {
        publisherId: "ca-app-pub-XXXX"
        testDeviceId: "DD3DXXXX" 
        banner: main.state == "main_menu" ? AdMob.None : AdMob.Smart
        anchors.bottom: scene.bottom
        anchors.horizontalCenter: scene.horizontalCenter
        z: 5
        //show ad everywhere except in state main_menu
        visible: main.state == "main_menu" ? false : true;
      }

This has somehow the desired effect. The ad is not visible in menu, during the transition to the game the ad is flickering once quickly and then after the transition is done it is shown again as it should. It solutions seems okay but the flickering looks a bit buggy.

2.

`AdMob {
 id: ads
 publisherId: "ca-app-pub-XXXX"
 testDeviceId: "DD3DXXXX" 
 banner: AdMob.Smart`
 anchors.bottom: scene.bottom
 anchors.horizontalCenter: scene.horizontalCenter
 z: 5
 }
onStateChanged: ads.visible = state !== "main_menu"

This have the same desired effect without the flicker during the transition. The ad is visible immediately when state changes also during transition (which is okay).  There is how ever a bug. First time starting the game the ad is not visible. It is there but you cannot see it. You can click the link and it will take you to the ad website, but it is invisible. After returning to the game from background the ad is visible and seems to works as it should.

Any ideas what could be problematic here?

 

BTW: I’m testing on android 4.1.2 using Samsung galaxy s3 mini.

  • This reply was modified 4 years, 2 months ago by  maitek.
  • This reply was modified 4 years, 2 months ago by  maitek.

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