Appodeal Listener got earwax?

Thanks Rob.

So, at the top of the scene I have:

local appodeal = require( "plugin.appodeal" )

then I have: 

-- Initialize the Appodeal plugin appodeal.init(appodealListener, { appKey = "MY KEY IN HERE\*\*\*\*\*\*\*\*\*\*\*", locationTracking = false, supportedAdTypes = {"banner", "rewardedVideo"}, bannerAnimation = true, testMode = true })

at the very beginning of scene:create(), which does quite a bit including setting up some buttons for the user. These are handled here below where the “handleButtonEvent( event )” detects which button was pressed and if it’s the “mail” button calls “onComplete( event )” which sets a yes/No Alert as to wether they want to continue to the video.

If yes then appodeal.show( “rewardedVideo” ) is called from here. (The commented out section is an alternative to calling "myFeatureFunction() inside the appodealListener by setting “watchedAd” to true, which doesn’t work either.)

local function onComplete( event ) if ( event.action == "clicked" ) then local i = event.index if ( i == 1 ) then appodeal.show( "rewardedVideo" ) appodeal.getRewardParameters() -- if watchedAd then -- myFeatureFunction() -- watchedAd = false -- end elseif ( i == 2 ) then --do nothing if No Thanks end end return true end -- local function handleButtonEvent( event ) if ( "ended" == event.phase ) then if event.target.id == "mail" then local msg = "In order to continue a short ad video will now play.".. "The email dialog will open on completion. Is that OK? ".. "You may want to lower the volume?" local alert = native.showAlert("Ad Warning!", msg, { "Yes", "No Thanks!" }, onComplete ) elseif event.target.id == "selectParticle" then print("select particle") elseif event.target.id == "exampleListButton" then print("exampleListButton") transition.to( exampleList, { time=500, alpha=1 } ) transition.to( exampleList, { time=500, delay=4000, alpha=0} ) end end return true end 

I do not have a .load() as the docs said it is done automatically and the video is always ready to play. It’s afterwards that is the problem.

I don’t recommend initializing ad plugins inside a scene. This is best done in main.lua or a module loaded by main.lua so you can guarantee it only happens once. 

Then you should be using your appodealListener() function to test if the rewardedVideo was completed and then from there, call your code to process your reward.

Rob

Stupid me?

elseif (phase == "playbackEnded"........

in the appodeal Listener should be :

elseif (event.phase == "playbackEnded"........

So was never detecting “playbackEnded” !!

Working OK (for) now… I’ll be back!