Anyone got mobile ads working on any platform with latest Monogame?

So in addition to the problems I’ve hit with the latest Monogame (detailed here), I’ve now come across a roadblock - I spent a large chunk of this weekend gone attempting to intergrate ads into my latest project, but nothing seemed to work.

For Windows Phone 8.1, I’ve tried Adrotator, Pubcenter and Vserv Adwrapper - Adrotator built but did not display ads, the Pubcenter tutorial (found here) refers to adding a connected service that appears not to be available, and from what I can see, WP8.1 projects don’t build XAP files, which are required by Vserv.

I also looked at Admob, but this doesn’t support WP8.1, so I would need to downgrade to WP8.0, which would mean going back to my old dev PC (as I can’t seem to get any version of the WP8.0 template working on my new box) - not ideal.

For Android, I tried Admob and Vserv again. The Vserv-adwrapped version of the apk file crashed on running, while adding the Xamarin Google Play Services to my application caused the build to throw “Error: No resource found that matches the given name: attr ‘android:actionModeShareDrawable’” errors in several places.

I could possibley go back to my old implementation of Admob - referencing the admob DLL via a java wrapper - but this would require legacy ad unit IDs in admob, so I would have to point my new game at the ad unit ID of one of my older ones, and I’m not sure how kindly Google would take to this!

I’ve emailed various people where appropriate in order to try and find out more, but I was wondering if anyone had had similar issues and if/how they resolved it - or if there were any alternative ad providers that anyone has managed to get up and running?

I have AdMob on Android working correctly with the latest MonoGame.

Check you have the latest Android SDK installed and try build against it, I have a bunch of problems getting Google Play Services to build in my app and I think that fixed them.

@daveleaver Got Play services working in a test app thanks to some support from Xamarin - how did you position the banner ad over the Monogame game display?

As for WP8, it looks like I’m just going to have to bite the bullet and downgrade to WP8 - as well as not being able to get ads working (and having succeeded in getting admob working on WP8), the sporadic freeze-on-touch bug I’ve been getting on WP8.1 means I can’t be confident releasing yet.

Roughly like this

Dump of code from my app:

Call CreateAndSetContentView to set it up, then Update to toggle visiblility.
Only TopCenter is implemented as you can see :smile:

I set it up in Program.cs like this:

var g = new Game1();
var view = (Android.Views.View)g.Services.GetService(typeof(Android.Views.View));
AdManager.CreateAndSetContentView(this, view, AdUnitId, TestDeviceIds);
1 Like

@daveleaver Up and running on Android! Thanks so much!

Just one little glitch to resolve - at the moment, it takes about a minute for the first ad to load, but I’m hoping to be able to fiddle with the settings in order to vastly reduce the refresh time until the display starts.

On the Windows Phone side, I’ve downgraded back to WP8.0 - not only does this allow me to use Admob, but also resolves various uncertainties and issues I was having with 8.1, and also means that I have a universal codebase between platforms, which was not possible on WP8.1 thanks to the removal of IsolatedStorage.

Next stop - iOS!

Cool, glad that helped.

Hi @daveleaver, I was trying to integrate AdMob into my MG Android project following your code example, but apparently it is not working with the latest MG source. I mentioned the error in this post:

I wonder if there is any chance that you help look into this issue? Thanks very much! :smile: