2 different rewards in AdMob

Hello. I have this code for rewardedVideo in adListener event:

elseif event.phase == "reward" then
	db:exec([[UPDATE data SET cash=cash+100;]])  
end

When I click button, then ad starts and after that I get reward.

But what I can do if I want 2 buttons with different rewards? For example - first one gives 50 dollars, second one gives 100 dollars. Buttons and adListener aren’t in the same scene.

Does anybody have an idea?

In most of the Admob methods you can pass the adunit. This isn’t well documented but it is there unless somebody deleted. When I asked about adunits many years back somebody was kind enough to add it. So you can load and show different adUnits.

After I asked for this I ended up not using it. I set a variable with the “rewardType” when the person accepts the reward. When the callback comes back, I check the type of this same variable to award the prize.

1 Like

Thank you so much for answer @agramonte. It helped me a lot! :blush:

1 Like