libGDX, AdMob, and Google Play Leaderboards

Hi, I’m developing an app using libGDX and have some trouble integrating AdMob and Leaderboards. Lets start with AdMob.

I followed the AdMob tutorial in the libGDX wiki, but have a couple problems. I set my ads to display only when playing, so I have a class called “GameScreen” that shows and loads the ads when instantiated. That way ads don’t clutter the title screen or any other screen. The first problem is that ads don’t load immediately when GameScreen is loaded. LogCat says the ad finished loading, but it doesn’t display (and the AdView’s visibility is View.VISIBLE). Only when the next refresh occurs (in thirty seconds) do they start to show.

The second problem happens with ads not refreshing. Staying on the GameScreen playing the game will never interrupt the refresh cycle, but leaving the GameScreen does. When GameScreen exits, it sets the AdView’s visibility to View.GONE. Staying in the title screen longer than the time until the next ad refresh causes the cycle to go bork. LogCat prints out “Ad is not visible. Not Refreshing ad.” and schedules an ad refresh in sixty seconds (not sure why it’s not thirty seconds). When you return to the GameScreen, an ad loads and doesn’t refresh. Returning to the title screen and going back to the GameScreen does load a new ad, but it doesn’t refresh automatically after thirty seconds while playing. The same ad will show until the player exists the GameScreen.

Here’s the code for my MainActivity: Clicky!
And here’s the code for my Ad Handler: Clicky!

GameScreen calls SHOW_ADS and LOAD_ADS when created, and HIDE_ADS when it exits.

------------------------

Now for leaderboards. I read the tutorial on the libGDX wiki, but it doesn’t go into much detail and only talks about updating scores and achievements. I want to send the scores to a leaderboard I created in my Google Play dashboard and show the leaderboards when I press a button in-game. How do I change the view to the leaderboards view, and send scores to it?

Let me know if you need any more details. Any help would be appreciated for either of my two problems! :smiley: