Admob new rewarded video api causing a memory leak?,Admob new rewarded ad api causing a memory leak
After we upgraded from admob's deprecated rewarded video api to the newer one, we started having ANRs caused by memory leak.
The tutorial for the rewarded ad says:
"RewardedAd is a one-time-use object. This means once a rewarded ad is shown, the object can't be used to load another ad. To request another rewarded ad, you'll need to create a new RewardedAd object."
After I am done with a rewarded ad I create a new one like this:
void InitializeRewardedVideo()
{
this.rewardedAd = new RewardedAd(GetAdUnitID(AdType.REWARDED));
//this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
this.rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad;
this.rewardedAd.OnUserEarnedReward += OnAdRewarded;
this.rewardedAd.OnAdClosed += OnRewardedVideoClosed;
Debug.Log("Load new rewarded video ad");
this.rewardedAd.LoadAd(GetAdRequest());
}
I think the memory leak is caused by this. The new api doesn't have a destroy method for rewarded ad. So my question is: how to properly initialize a new rewarded video ad after you are done with the previous one?
Your answer
Follow this Question
Related Questions
Admob banner not showing on device 0 Answers
Help with AdMob interstitials 0 Answers
can i use admob ads with unity ads in Unity3d Game? 0 Answers
How to put admob in unity game? 0 Answers