Forum Libraries, Components, and Plugins

AdMob banner not refreshing after screen is turned back on

ShermanUitzetterShermanUitzetter USMember ✭✭

I'm using Google Play Services to show an AdMob banner in my game.

It seemed to be working fine (test banners load and refresh), but today I discovered something and I need help. When I start the game, I get the AdMob test banner. As the game is played, every 60 seconds a new test ad is loaded (I see messages in the Application Output that say "Ad finished loading.") This is all correct. However...

Today I discovered that, during game play, if the screen is turned off and then back on, new ads fail to load from that point on. I can still see the banner ad (and even click it), but every 60 seconds the Application Output says "Ad is not visible. Not refreshing ad." Play Services seems to think the banner is no longer visible and it doesn't load a new ad.

I'm hoping somebody has come across this issue before me and figured it out.

Edit: forgot to mention this is all Android. I need to test iOS (doing that right now).
Edit 2: iOS works fine.


  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai
    edited January 2015

    Hi Sherman,

    Based on this and here, it appears that what you're encountering isn't unique to CocosSharp/monodroid.

    As mentioned in those links, one suggestion is to ensure the OnPause/OnResume methods of the activity are correctly setup to pause/resume the corresponding ad view. Hope that helps.

  • ShermanUitzetterShermanUitzetter USMember ✭✭

    Thanks for checking into it. That first StackOverflow link describes my exact issue. Pausing/resuming of the AdView doesn't help, but it's good to have that.

    I realize this isn't a CocosSharp/MonoGame issue (I should have mentioned that). I just figured people in here would have come across this. AdMob banners in Android games aren't rare (or are they?). I was hoping there would be other people in this forum putting AdMob banners on their games. That's why I posted here.

    Is this working for anybody?

  • Parth2651Parth2651 USMember

    @spotcatbug do you find any resolution with this?

    its working in ios as i am able to get UIViewcontroller for ios and add adview

    var viewController = _application.Game.Services.GetService();

    still fighting to work for android.

  • ShermanUitzetterShermanUitzetter USMember ✭✭


    I never did find a fix.

  • Parth2651Parth2651 USMember

    finally i am able to make banner ad working for my android cocossharp project

    here is few tips which might help
    i used tommyparnell 's repo to set the basics

    but the problem is android is showing "ad finished loading" message in output but no ad on screen (as mentioned by @spotcatbug )

    what i did is create activity object and add adview inside activity with layoutparam

    //get Android activity from Application object
    Activity vw = _application.AndroidContentView.Context as Activity;

    //create LayoutParams
    ViewGroup.LayoutParams lparam = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

    //add adview to activity
    vw.AddContentView(FinalAd, lparam);

    and finally ad is showing :smiley:

    see if this help @spotcatbug

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai


    Thank you for posting your solution for others that may need the same functionality. Greatly appreciated.

Sign In or Register to comment.