[Unity] How to check if user don't end to see an Ad?

199 views
Skip to first unread message

Carlos Delvalle

unread,
Jun 19, 2020, 4:58:26 PM6/19/20
to Google Mobile Ads SDK Developers
I'm trying to find a way to handle when a user starts to see an ad rewarded and doesn't finish to do.
AdMob doesn't provide me a callback to check that and I tried to use OnAdStart to mark that the user was not complete to see and when AdMob fired OnAdComplete marked as completed, but some ad networks didn't send these callbacks.

Any suggestions.

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 21, 2020, 9:22:25 PM6/21/20
to carlosde...@gmail.com, google-adm...@googlegroups.com

Hi Carlos,

 

Thank you for reaching out to us.

 

The OnUserEarnedReward callback should prove useful in checking whether or not the user has completely watched an ad (and thus be eligible for a reward). The officially supported mediated networks should automatically call this callback as well.

 

Regards,

Ziv Yves Sanchez

Mobile Ads SDK Team



ref:_00D1U1174p._5004Q217zfO:ref

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 22, 2020, 1:32:13 AM6/22/20
to carlosde...@gmail.com, google-adm...@googlegroups.com

Hi Carlos,

 

You'll notice that the OnUserEarnedReward callback will return false if the user closed the ad before completing it.

Carlos Delvalle

unread,
Jun 22, 2020, 9:13:13 AM6/22/20
to Google Mobile Ads SDK Developers
I'm using the legacy API and when I close the ad, OnAdRewarded didn't trigger if the user didn't complete the see the ad.
Where I can check the result? because the signature gives you 2 variables
.
Reward only have 2 properties and sender is an object.

public void HandleRewardBasedVideoRewarded(object sender, Reward args)
{
   
string type = args.Type;
   
double amount = args.Amount;
   
print("User rewarded with: " + amount.ToString() + " " + type);
}

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 22, 2020, 12:33:28 PM6/22/20
to carlosde...@gmail.com, google-adm...@googlegroups.com
Hi Carlos,

I work with Ziv and will try to assist you. If you are using your own API to keep track of non rewarded Rewarded Ads then let me suggest an unsupported general programing way to do it. According to our documentation, a user has to be given a choice wether to see the rewarded ad or not as described here  - https://developers.google.com/admob/unity/rewarded-video#show_the_ad. Based on this information 
I made an enum like this:

enum AdState {failed, loaded, started, rewarded}

I then instantiated the enum and a button to show the ad. When ad is loaded the button becomes active. When button is pressed you change the enum state to AdState.started. If rewarded then the enum is changed to AdState.rewarded. You can call your API in a callAPI() function in the callback HandleRewardBasedVideoClosed() and check if the enum is rewarded or just started. If it's just started then you can call your server that there was no reward.

Kind regards,
Aryeh Baker
Mobile Ads SDK Team


ref:_00D1U1174p._5004Q217zfO:ref
Reply all
Reply to author
Forward
0 new messages