AdMob - Intertstital advert, graphical issues

Hi there.

I’ve managed to get AdMob interstitial adverts working in my game using the Xamarin Google Play Services component. The advert takes over the screen correctly but when I close it and return to the game, all of my sprites appear as black rectangles.

I’m using MonoGame 3.2 (the .dll assembly version says 3.1.2.0). Any help would be appreciated.

Cheers,
Ronny.

1 Like

Hi!

This has been fixed here https://github.com/mono/MonoGame/pull/2443

You should either download and recompile MonoGame from source or wait for the fix to be available in the next release and then update.

Thanks for the quick response. I downloaded and compiled the latest source but my game initialization code is failing to compile, ie.

Game1.Activity = this;
var g = new Game1();
SetContentView(g.Window);
g.Run();

Results in 3 compilation errors:

Error CS0200: Property or indexer ‘Microsoft.Xna.Framework.Game.Activity’ cannot be assigned to – it is read only
Error CS1502: The best overloaded method match for ‘Android.App.Activity.SetContentView(Android.Views.View)’ has some invalid arguments
Error CS1503: Argument 1: cannot convert from ‘Microsoft.Xna.Framework.GameWindow’ to ‘Android.Views.View’

If this is an easy fix from my end then I’ll give it a go. Otherwise, no problem, I can wait till the next MonoGame release.

Hi!

yes, this part was changed a bit

I think now setting the Game’s Activity is no longer needed, and the SetContentView is something like this:

SetContentView ((View)g.Services.GetService (typeof (View)));

1 Like

Yep, that fixes the compilation errors. The latest source also fixes my original problem with the black rectangle sprites. Thanks for that KakCAT :smile:

1 Like

Thanks for the tip! Got stumbled with new View logic too :slight_smile:

I’ve upgraded to Monogame 3.2.2 alpha but I still get this problem on a Nexus 5. But not many other devices…

Edit. It turned out to be a problem with my textures being static. Very strange that it worked fine on 2 out of 3 android devices.