RevMob: Getting info when a video ad (or other interstitial) was watched (or closed)?

  1. How can I manage to start a function after a video was watched or a full screen ad was closed? How do I catch this events with revmob?

AND

  1. When a video was shown… do I have to use revmob.load to load a new one before showing the next? Or is it okay to once load a video and the show it whenever it is needed? Will the “cycle” of videos be done by revmob or do I have to do it manually somehow?

Thx for your help!

Each action should be triggering an event to the function you passed to revmob.init(). Perhaps something like:

local function handleRevMobEvents( event )     if event.phase == "videoPlaybackEnded" then         -- do something after a video has ended     elseif event.phase == "rewardedVideoPlaybackEnded" then         -- do something after a rewarded video has ended     elseif event.phase == "rewardedVideoCompleted" "then         -- do something after the user has completed the rewarded video process     end end revmob.init(  handleRevMobEvents, { appId="YOUR\_APP\_ID" } )

That code is untested btw…

See: https://docs.coronalabs.com/plugin/revmob/event/adsRequest/phase.html

Regarding #2, that is not clear to me from the RevMob docs. However, from what I have gathered from the docs and sample code for other ad libraries, the answer is that once an ad has been shown it is no longer available to be shown again. If you want another ad, you first need to call load and then wait for the loaded event before calling show again. Your use case may vary but one of my games displays interstitial ads between levels. I am using a different SDK for this game but what I do is I load an ad when the game starts. At the end of a level, if an ad is available, I show it. Once that ad is closed, I immediately load the next ad. Hopefully a Corona dev can chime in. Otherwise, I recommend creating a tester app using one of the other ad framework’s sample projects as a starting place (e.g. https://github.com/coronalabs/plugins-sample-inmobi

You are correct.

Once an ad has been shown, you have to call load() to load a new one.

Each action should be triggering an event to the function you passed to revmob.init(). Perhaps something like:

local function handleRevMobEvents( event )     if event.phase == "videoPlaybackEnded" then         -- do something after a video has ended     elseif event.phase == "rewardedVideoPlaybackEnded" then         -- do something after a rewarded video has ended     elseif event.phase == "rewardedVideoCompleted" "then         -- do something after the user has completed the rewarded video process     end end revmob.init(  handleRevMobEvents, { appId="YOUR\_APP\_ID" } )

That code is untested btw…

See: https://docs.coronalabs.com/plugin/revmob/event/adsRequest/phase.html

Regarding #2, that is not clear to me from the RevMob docs. However, from what I have gathered from the docs and sample code for other ad libraries, the answer is that once an ad has been shown it is no longer available to be shown again. If you want another ad, you first need to call load and then wait for the loaded event before calling show again. Your use case may vary but one of my games displays interstitial ads between levels. I am using a different SDK for this game but what I do is I load an ad when the game starts. At the end of a level, if an ad is available, I show it. Once that ad is closed, I immediately load the next ad. Hopefully a Corona dev can chime in. Otherwise, I recommend creating a tester app using one of the other ad framework’s sample projects as a starting place (e.g. https://github.com/coronalabs/plugins-sample-inmobi

You are correct.

Once an ad has been shown, you have to call load() to load a new one.