- Home /
admob rewarded video ad dont reward
i implemented admob ads successfully however im having issue with when player closes the ad , my goal is to check if player completed the ad to get rewarded , basically what i have now is that i can display a gameover panel when ad is closed while the ad is running which is nice , but the gameover panel shows even when player have succesfuly watched the ad , so how can i acheive that ? public void HandleRewardedAdLoaded(object sender, EventArgs args) { MonoBehaviour.print("HandleRewardedAdLoaded event received"); }
public void HandleRewardedAdFailedToLoad(object sender, AdErrorEventArgs args)
{
MonoBehaviour.print(
"HandleRewardedAdFailedToLoad event received with message: "
+ args.Message);
}
public void HandleRewardedAdOpening(object sender, EventArgs args)
{
MonoBehaviour.print("HandleRewardedAdOpening event received");
}
public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
{
MonoBehaviour.print(
"HandleRewardedAdFailedToShow event received with message: "
+ args.Message);
}
public void HandleRewardedAdClosed(object sender, EventArgs args)
{
GameOverPanel_OnAdClosed.SetActive(true);//this is the gameover panel , it shows when player close ad on middle or successfully finish watching it
MonoBehaviour.print("HandleRewardedAdClosed event received");
}
public void HandleUserEarnedReward(object sender, Reward args)
{
RewardNotif.SetActive(true);
string type = args.Type;
double amount = args.Amount;
MonoBehaviour.print(
"HandleRewardedAdRewarded event received for "
+ amount.ToString() + " " + type);
}
Answer by polyphonic13 · Mar 21, 2021 at 03:22 PM
@eni_cay I've run into a similar issue. The OnAdClosed callback always gets call, but the OnUserEarnedReward only gets called if they finish watching. Worse still, it gets call after the OnAdClosed callback. I've had to add an ugly hack to deal with this. The Level scene has an isRewarded
bool and a timer utility (that counts for n seconds and that triggers a callback.) If the user watches the entire rewarded add, the OnAdClosed handler is called first, it waits 1 second for the OnUserEarnedReward callback to be called and then either continues the level or moves on to the next scene. This causes a 1 second "loading" icon to be displayed each time. I'd really like a cleaner way of doing this.
public void OnUserEarnedReward(string type, double amount)
{
isRewarded = (amount > 0) ? true : false;
}
public void OnAdClosed(AdType type)
{
timer.StartCountDown(1, () =>
{
if (!isRewarded)
{
gotoInterstitialOrTitle();
}
continueLevel();
});
}
Your answer
Follow this Question
Related Questions
Admob rewarded video give more and more reward. Why 3 Answers
Video Ads not showing correctly on IOS 1 Answer
Admob Reward video not showing up, but the test ad unit is showing. 2 Answers
Admob video ad shows only once on the phone ? 1 Answer
admob legacy api can load multiple video ads but new api doesn't ? 0 Answers