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

Forums

OverviewFelgo 1 Support › hide/show Admob banner

Tagged: , , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7277

    Mathias

    Hi.

    I have been trying to integrate admob banner into my game. So far I managed to get the test banner up and running. But the problem is that it is showing all the time. I want the banner to show during gameplay, but not in the main menu, because it overlaps my buttons. I tried to hide the banner using following code, but then the banner was not visible at all.

        AdMob {
            publisherId: "ca-app-pub-XXXX"
            testDeviceId: "DD3DXXXX" 
            banner: 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;
          }

    How can I hide the banner in the menu and show it only during the gameplay?  AdMob item is a child of Scene item. My game has only one Scene (used for both menu and game).

    Thanks,

    Mathias

     

    #7278

    Christian
    Felgo Team

    Hi Mathias,

    could you try it with the following property binding (and leaving visible untouched):

    banner: main.state == "main_menu" ? AdMob.None : AdMob.Smart

     

    Cheers, Chrisu

    #7280

    Christian
    Felgo Team

    Hi again,

    actually ignore the first post because the None property doesn’t remove the ad.

    The visible property should be able to remove it. Are you testing on iOS or Android?

    Try setting visible to false explicitly somewhere:

    onStateChanged: ads.visible = state == "main_state"

    Maybe this will help.

    #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 10 years ago by  maitek.
    • This reply was modified 10 years ago by  maitek.
    #7284

    Christian
    Felgo Team

    I think you should stick to the second solution. Can you try if the bug exists on other devices as well (you can always try the Android emulator).

    Maybe try explicitly setting visible to true via QML or via JS when in Component.onComplete().

     

    Cheers,

    Chrisu

    #7308

    Mathias

    Hi. I resolved the problem in case 2, by setting visibility explicitly to false in the ad so that it is not loaded when the app is starting. Thanks a lot for the quick support.

    Mathias

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded