- Home /
in rewarded ad which code means user closed the ad by itself
in these codes which one means user closed ad by himself or herself
// Called when an ad request has successfully loaded. this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded; // Called when an ad request failed to load. this.rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad; // Called when an ad is shown. this.rewardedAd.OnAdOpening += HandleRewardedAdOpening; // Called when an ad request failed to show. this.rewardedAd.OnAdFailedToShow += HandleRewardedAdFailedToShow; // Called when the user should be rewarded for interacting with the ad. this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward; // Called when the ad is closed. this.rewardedAd.OnAdClosed += HandleRewardedAdClosed;
Answer by WaqasHaiderDev · Aug 11, 2020 at 10:11 PM
Hi, this line
// Called when the ad is closed.
this.rewardedAd.OnAdClosed += HandleRewardedAdClosed;
Answer by polyphonic13 · Mar 21, 2021 at 03:29 PM
@ZealGamesStudio have you found a solution to early close by users during a rewarded ad? I've noticed that the OnUserEarnedReward
is only called if the user completes the ad. The OnAdClosed
is always called, but from my tests, it's called before OnUserEarnedReward
. To work around, I added an ugly hack that adds a timer to OnAdClosed
to give 1 second for the OnUserEarnedReward
to be called before determining whether to reward the user or move on.
I'm following this documentation https://developers.google.com/admob/unity/ad-placements, which doesn't address early close and haven't found any other references through searching.
I'm having a little issue because of that, I'm trying to start to load the next ad right after the last is closed, but it seem this is not possible because if I reload the ad OnClose then OnRewardEarned will never get called. There are a couple of alternatives like loading two ads interchangeably, but anyway, firing OnClose before OnRewardEarned sounds a bit unintuitive to me.
Your answer
![](https://koobas.hobune.stream/wayback/20220613003403im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Admob script help 0 Answers
AdMob Rewarded Video Ad 0 Answers
Admob rewarded video working in Unity but not on android device. 0 Answers
Getting Sprites to Face Eachother (building on 2D Platformer tut) 0 Answers
Can I make Money collecting script without attaching it to a object ? I tried but I got error 2 Answers