- Home /
Question by
HakanOzcan · Feb 23, 2015 at 01:11 PM ·
admobgoogle playgoogle play gamesgoogleadvertising
Destroy Banner/Interstitial ads of AdMob?
I have a banner which only needs to be shown in main menu. And I want to show interstitials whenever player finish the game and about to return back to mainmenu. There is no problem for requesting and showing ads. However, google says me that
When you are finished with a BannerView or InterstitialAd, make sure to call the Destroy() method before dropping your reference to it.
bannerView.Destroy();
interstitial.Destroy();
This notifies the plugin that the object should be garbage collected. Failure to call this method will result in memory leaks.
I dont know when I should destroy my ads? Eachtime player exit game (For banner)? Eachtime player goes from mainmenu to game (For banner)? Should I destroy interstitials after showing it and request back when I want to show again?
Comment
Use it in
OnDestroy ()
method. This should work. But make sure that you're calling the destroy method only in thr class where you're getting the message.