Fallback between iAd and AdMob

I am creating the “fallback” if one of the ad providers triggers the ‘event.isError’, something like this:

        if(event.isError) then             if bannerProvider == BANNER\_IAD then                 ads:setCurrentProvider(NATIVE\_ADMOB)                 showAdAdMob()             elseif bannerProvider == BANNER\_ADMOB then                 ads:setCurrentProvider(NATIVE\_IADS)                 showAdIAd()             end        end  

_ Question: _

Is it necessary to call ads.hide() before the switch to new provider?

What I am afraid is not to overload the memory if the “old” ad is not removed from memory.

This is a very important question, I am sure many developers will implement something like this.

Please someone from Corona team answer this.

Thank you!

Hi ubj3d.android@, 

Yes, I recommend that you hide the ads before changing providers, as this deallocates the memory assigned to the view controller. It’s good defensive programming.

Take care,

Brent

Hi ubj3d.android@, 

Yes, I recommend that you hide the ads before changing providers, as this deallocates the memory assigned to the view controller. It’s good defensive programming.

Take care,

Brent