Appodeal video reward, not rewarding...?

So I have been trying so much different things and I have reviewed many of the codes posted in the forum… but I can’t seem to get it to work. 

 
I am trying to do a simple task, when the member loses the game, do a popup via the below code (only allows it 2 times per game)

local function endGame() if timesRewareded \< 2 and settingsTable.didWin == false then local alert = native.showAlert( "You have used up your 3 tries.", "Would you like to watch this short video ad to continue the game and get a free hint?", { "No Thanks!", "Yes!" }, onComplete ) else endGameNow() end end

Which button is clicked is checked by the onComplete function: 

local function onComplete(event) if ( event.action == "clicked" ) then local i = event.index if ( i == 2 ) then --If clicked Yes! print("Clicked yes, lets watch a video!") appodeal.show("rewardedVideo") elseif ( i == 1 ) then --If clicked No thanks! --Cancel and just continue to end game print("Clicked no, lets end the game!") endGameNow() end end end

If they click no thanks, it just finishes ending the game and showing the score screen.  If they press Yes, then it runs the video.  This is where I am having the trouble.  I can get the video to show fine… but the adListener event doesn’t seem to ever pick up the fact that the video is over or was watched. 

Once it’s picked up that it has been watched I want to run the rewardThem() function, but it doesn’t seem to be running.  Since the simulator doesn’t run ads, I can’t see if the rewardThem() function is running and just not working properly, or if its just not running at all. 

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) elseif ( event.phase == "playbackEnded") and (event.type == "rewardedVideo") then elseif (event.phase == "closed") then rewardThem() end end

I have placed the rewardThem() just about everywhere I can think of and no luck.  Any ideas?

Hello @Klynt 

I am Appodeal’s Community Manager. Have you already reached out to support team in Appodeal dashboard? If not, please share you appkey and email so they can reach out. We’ve already sent this problem to support team.

Please move the code before “appodeal.init”

local function adListener( event )

if ( event.phase == “init” ) then – Successful initialization
print ( event.isError )

elseif ( event.phase == “playbackEnded”) and ( event.type == “rewardedVideo”) then

elseif ( event.phase == “closed”) then

rewardThem()

end
end

_______________________________
 

As in instruction
https://www.appodeal.com/sdk/documentation?framework=36&full=1&platform=4#p_3_6

I am afraid the only way to test ads is to build for the device and keep an eye on the console for your various print statements (either corona console or adb logcat). Also if i were you i would make my adListner more comprehensive, something like this:

local function adListener( event ) if ( event.phase == "init" ) print(tostring(event.phase)..": isError: "..tostring(event.isError)); elseif ( event.phase == "loaded" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "displayed" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "clicked" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "closed" ) print(tostring(event.phase)..": "..tostring(event.type)); rewardThem(); elseif ( event.phase == "hidden" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "failed" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "playbackBegan" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "playbackEnded" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "dataReceived" ) print(tostring(event.phase)..": "..tostring(event.type)); end end

That way you could test all the various scenarios (ad clicked or not clicked, watched all the way or not, app closed or suspended during playback, … all real life scenarios that might occur with your users) and callbacks and then decide where is the best place to put rewardThem().

EDIT: Just in case you need it, here is a link to corona’s guide on how to debug your app when it is on the device.

Hello @Klynt 

I am Appodeal’s Community Manager. Have you already reached out to support team in Appodeal dashboard? If not, please share you appkey and email so they can reach out. We’ve already sent this problem to support team.

Please move the code before “appodeal.init”

local function adListener( event )

if ( event.phase == “init” ) then – Successful initialization
print ( event.isError )

elseif ( event.phase == “playbackEnded”) and ( event.type == “rewardedVideo”) then

elseif ( event.phase == “closed”) then

rewardThem()

end
end

_______________________________
 

As in instruction
https://www.appodeal.com/sdk/documentation?framework=36&full=1&platform=4#p_3_6

I am afraid the only way to test ads is to build for the device and keep an eye on the console for your various print statements (either corona console or adb logcat). Also if i were you i would make my adListner more comprehensive, something like this:

local function adListener( event ) if ( event.phase == "init" ) print(tostring(event.phase)..": isError: "..tostring(event.isError)); elseif ( event.phase == "loaded" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "displayed" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "clicked" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "closed" ) print(tostring(event.phase)..": "..tostring(event.type)); rewardThem(); elseif ( event.phase == "hidden" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "failed" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "playbackBegan" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "playbackEnded" ) print(tostring(event.phase)..": "..tostring(event.type)); elseif ( event.phase == "dataReceived" ) print(tostring(event.phase)..": "..tostring(event.type)); end end

That way you could test all the various scenarios (ad clicked or not clicked, watched all the way or not, app closed or suspended during playback, … all real life scenarios that might occur with your users) and callbacks and then decide where is the best place to put rewardThem().

EDIT: Just in case you need it, here is a link to corona’s guide on how to debug your app when it is on the device.