Problems with Applovin's Rewarded Videos

Hi everyone, i am having problems with applovin’s rewarded videos.

I write the code as shown on the applovin documentation, and it works, the video is shown and it appears in applovin’s dashboard. The problems appears after the video, when it should give the reward, in fact it doesn’t at all.

Here is some code:

local adListener adListener = function( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) -- Load an AppLovin ad applovin.load( "rewardedVideo" ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) elseif ( event.phase == "displayed" or event.phase == "playbackBegan" ) then -- The ad was displayed/played Toast.show("Video Played") applovin.load("rewardedVideo") elseif ( event.phase == "hidden" or event.phase == "playbackEnded" ) then -- The ad was closed/hidden print( event.type ) elseif ( event.phase == "clicked" ) then -- The ad was clicked/tapped print( event.type ) end end applovin.init( adListener, { sdkKey="My Code", verboseLogging=false } )

the later on, in a button llistener:

 if(applovin.isLoaded("rewardedVideo")) then applovin.show("rewardedVideo") end

So the video shows, but i don’t get the toast notification, or whatever else i put in the function.

Every help would be appreciated

Hi;

Check out this page:

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

You need to check for:

(event.phase == “validationSucceeded”)

Steve

Hi Steve, thanks for the reply.

I just tried, and sadly it doesn’t work either.

Just like before, i play the video but no toast notification.

Hi;

Did you get an event.phase of “validationSucceeded” ?? You could put a “print” statement in your code to see whether you get this event.phase.

Also, you did set up “Rewarded Video” in the Applovin dashboard, correct???  One thing you can set up there in their dashboard is whether Applovin will display a confirmation dialogue before and after the rewarded video. These confirmation dialogues are a way you can be certain the Applovin is serving up the ad properly. They call them “pre-video” and “post-video” modals.

Steve

Hi steve,
Yes i wrote the statement on the adListener function, but it doesn’t work.
Applovin is serving fine, when i try the app on my phone i watch the ad and it plays fine, then i go on applovin and it shows the ad impression i just had, so no problems on that side.
How can i use the print statement? I mean, while testing on my phone, what software should i use to live debug? Because applovin doesn’t work with corona live debugger.
But also there is the toast notification that should turn on when that funtion is executed but still doesn’t

Hi;

Debugging on a device is explained in a number of places. This is a good place to begin:

https://docs.coronalabs.com/guide/basics/debugging/index.html

Why don’t you set up the “pre-video” and “post-video” modals in the Applovin setup page for your app? Then you can see whether you are actually getting a “rewarded video” that begins and ends properly.

Steve

But it does show on applovin dashboard page, so the ad shows correctly.
Do you think i should add that?

Hi;

I’m just suggesting that you get some visual confirmation in real time that it is an actual rewarded video that is firing (the modals will do that).

Also, why don’t you add this code to the very beginning of the listener and that way you will see each phase as it occurs on your device:

native.showAlert(“Got HERE”, "This is the listener event phase: " … event.phase , {“OK”})

Of course, you do have to wait until the very end of a rewarded video to get the “validationSucceeded” phase, right?

Steve

Didn’t think about that.

But if i had the alarm at the beginning of the listener it will go on as i start the app also, right?

Okay, now it is getting a little weird.

I did what you said and in the alarm i get “loaded” then “displayed” then “playbackbegan” then “plaubackended” and the last one is “validationsuceeded”.

But still nothing of what i write in the listener gets executed.

Hi;

Put it wherever you think is appropriate to capture the important info. I’d put it at the beginning so I could get an alert at each stage of the sequence  – even the “init” and the “loaded”.

One last thing. You don’t have an “else” at the end of your conditional statements. What if the “phase” is one that you are not covering in all of the “elseif” conditionals – that phase would pass silently and you would never know it happened.

Steve

That may happen, yes, but the only phase i am interested in is “validationsucceeded” so i don’t need to cover all the other possible options.

But as i said the alarm goes on and tells me the validationsucceeded phase but still nothing happens.

Hi;

I’ve never worked with the Toast plugin.

If you are triggering Toast when you get “validationsucceeded”, are you certain that the Toast plugin is up and running properly??

and if you are getting the “validationsucceeded” phase properly, then there is nothing wrong with Applovin – it is working correctly.

Steve

Now i tried to replace the alarm with a toast and it doesn’t show up.

But the fact is still that the alarm said “phase: validationsucceeded” but the block code of the if statement didn’t work at all.

What could be the problem here?

It works now, i am an idiot.
First of all i had declared the toast plugin before the listener.
And second of all i forgot i renamed a variable in the app so when i executed the function there was the wrong name and it didn’t work. Now it works just fine thanks for the help :slight_smile:

Hi;

Check out this page:

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

You need to check for:

(event.phase == “validationSucceeded”)

Steve

Hi Steve, thanks for the reply.

I just tried, and sadly it doesn’t work either.

Just like before, i play the video but no toast notification.

Hi;

Did you get an event.phase of “validationSucceeded” ?? You could put a “print” statement in your code to see whether you get this event.phase.

Also, you did set up “Rewarded Video” in the Applovin dashboard, correct???  One thing you can set up there in their dashboard is whether Applovin will display a confirmation dialogue before and after the rewarded video. These confirmation dialogues are a way you can be certain the Applovin is serving up the ad properly. They call them “pre-video” and “post-video” modals.

Steve

Hi steve,
Yes i wrote the statement on the adListener function, but it doesn’t work.
Applovin is serving fine, when i try the app on my phone i watch the ad and it plays fine, then i go on applovin and it shows the ad impression i just had, so no problems on that side.
How can i use the print statement? I mean, while testing on my phone, what software should i use to live debug? Because applovin doesn’t work with corona live debugger.
But also there is the toast notification that should turn on when that funtion is executed but still doesn’t

Hi;

Debugging on a device is explained in a number of places. This is a good place to begin:

https://docs.coronalabs.com/guide/basics/debugging/index.html

Why don’t you set up the “pre-video” and “post-video” modals in the Applovin setup page for your app? Then you can see whether you are actually getting a “rewarded video” that begins and ends properly.

Steve