Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Problems with Applovin's Rewarded Videos
Started by lomeglio098 May 01 2019 08:29 AM

14 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

Hi;

 

Check out this page:

 

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

 

You need to check for:

 

(event.phase == "validationSucceeded")

 

Steve



[TOPIC: post.html]
#3

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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

[TOPIC: post.html]
#6

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

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



[TOPIC: post.html]
#7

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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

[TOPIC: post.html]
#8

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

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



[TOPIC: post.html]
#9

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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?

[TOPIC: post.html]
#10

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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.

[TOPIC: post.html]
#11

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

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



[TOPIC: post.html]
#12

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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.

[TOPIC: post.html]
#13

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 173 posts
  • Corona SDK

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



[TOPIC: post.html]
#14

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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?

[TOPIC: post.html]
#15

lomeglio098

[GLOBAL: userInfoPane.html]
lomeglio098
  • Observer

  • 18 posts
  • Corona SDK

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 :)


[topic_controls]
[/topic_controls]