Ads not hiding with ads.hide()

Hello!

I have built into our app a mechanism to switch between multiple ad networks like described in this tutorial: http://coronalabs.com/blog/2013/11/19/tutorial-using-multiple-ad-networks/

First of all, this is not working as expected, as I seem to get the ads from both providers (admob and inmobi) simultaneously on the screen.

I just call show with the first network (and the first listener), if the first listener gets an error, I switch to the other provider and call show again.

This is one problem, but another thing that really is bugging me is that when I call ads.hide(), not all ads disappear!

Especially the ad banners on the bottom of the app are not hidden. I call ads.hide() frequently in the app now, because of the multiple shown ads problem, but it does not seem to affect all ads.

Should ads.hide() not hide all ads on the screen?

We observed this behaviour yet on Android, on a Samsung Galaxy S3 with Android 4.3, but other devices seem to have similar problems.

Do you know this issue, or can think of any kind of solution for this?

Thank you for your help!

I think what’s happening is that your callbacks are getting called even though you’ve switched to another ad network.

As an example. I noticed that if I first displayed an iAd and later switched to Admob, that the iAd listener got called.

I call ads.hide() before I switch networks, so the iAd listener should in theory never be called after switching.

To work around the issue I keep track of which network is active and when a listener is called I first check if it’s the currently active network. If for example the iAd listener is called (and isError=false) when the active network is Admob, I temporarily  switch to iAd and call ads.hide() again and then switch back to Admob.

This trick seems to have worked around double banners being displayed.

I think what’s happening is that your callbacks are getting called even though you’ve switched to another ad network.

As an example. I noticed that if I first displayed an iAd and later switched to Admob, that the iAd listener got called.

I call ads.hide() before I switch networks, so the iAd listener should in theory never be called after switching.

To work around the issue I keep track of which network is active and when a listener is called I first check if it’s the currently active network. If for example the iAd listener is called (and isError=false) when the active network is Admob, I temporarily  switch to iAd and call ads.hide() again and then switch back to Admob.

This trick seems to have worked around double banners being displayed.