Dancing with MoPub: part 2
In part 1, I came to the mistaken conclusion that I had it all figured out.
Little did I realise that although I had “ads” working in MoPub, Admob ads weren’t.
Further investigation has revealed more issues:
- I didn’t realise it, but you have to copy all the ad network jar files into your Shiva project along with the MoPub jar file. It makes sense, but it was never explicitly mentioned in the MoPub documentation. Without the jar files, MoPub silently falls back to using the MoPub network, making it look like it’s worked, when it hasn’t.
- Leaderboard Admob banner ads flat-out don’t work in at least the current version of MoPub. The reason is that MoPub determine the sizes of the ads from the first message received when it first connects to the Admob network, which seems to always contain the dimensions 320×50, before you’ve requested any ads. MoPub saves these dimensions and uses them later after an ad request is completed. Obviously this causes problems because you might request a leaderboard at at 728×90, but MoPub thinks ads are only 320×50, so it shows nothing on screen, and you see a message like “Not enough space to show ad! Wants: <728, 90>, Has <320, 50>” in the log.
Thankfully MoPub is open source, so I could figure this out and create a hack that assumes that if the network is AdMob, and the screen is at least 728 pixels wide, then it’s going to be showing leaderboard banner ads, and resizes the ad view accordingly.
That makes two showstoppers courtesy of MoPub.
I have to be missing something because MoPub can’t be so broken that it doesn’t support AdMob properly? It’s bundled with AdMob!
Maybe it’s a specific problem with the way the Unity plugin is written and it’s doing something wrong? It wouldn’t be the first bug I’d found in the Unity plugin.
I’ve contacted MoPub to hopefully get a proper solution to this.
In the meantime, I’ve got AdMob ads displaying the way they are supposed to, so I can move on now.
Fun, fun, fun…