I am using the appodeal plugin, I have successfully inputted all the info I need with appodeal and changed my build.settings file etc.
within my app I have required the plugin
local appodeal = require( "plugin.appodeal" )
I have implemented the following at the beginning of my scene:create(event) function.
appodeal.init( adListener, {appKey = "MY\_APP\_KEY", testMode = true} )
(my app key is actually there in my code, just wanted to put in a filler to be on the safe side)
and I have the function adListener referenced in my code
local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) end end
I then have a button that when pressed, initiates the rewarded video through this function.
local function rewardReady(event) if event.phase == "ended" then appodeal.show("rewardedVideo") end end
When I build this to my device and I push the button, the video plays just as expected.
I have a few things im still trying to figure out…
- How exactly do I grant the reward for watching the video
I figure it would be a conditional “if” statement in the adListener function, but I tried
local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) elseif (event.phase == "playbackEnded") then gold = gold + 10 end end
But this did not work.
- I plan to have the button highlighted when there is an ad ready for the player to view if they choose and conversely the button will be dim and darkened when there is no video available to grant a reward.
I have all the images set up and I know how to change the frames of the button so it appears to light up etc. The problem is that I dont know how I should track if there is a video ready
I would assume that having the following runtime listener should help
rewardButton.enterFrame = adListener Runtime:addEventListener("enterFrame", rewardButton)
but again, I don’t know what I would be listening for to know that an ad is ready…
possibly event.phase.loaded???
please assist with any input
thank you
