Listener and calling init code:
local function adListener( event ) print("listener: event: ", event.phase) -- Successful initialization of the Appodeal plugin if ( event.phase == "init" ) then print( "Appodeal event: initialization successful" ) print(event.isError) -- An ad loaded successfully elseif ( event.phase == "loaded" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad loaded successfully" ) -- The ad was displayed/played elseif ( event.phase == "displayed" or event.phase == "playbackBegan" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad displayed" ) -- The ad was closed/hidden/completed elseif ( event.phase == "hidden" or event.phase == "closed" or event.phase == "playbackEnded" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad closed/hidden/completed" ) -- if( event.type == "rewardedVideo" and event.phase == "playbackEnded" ) then -- local currentScene = composer.getSceneName("overlay") -- --print("CURRENT SCENE : ", currentScene) -- if(currentScene == "scenes.nextlevel") then -- local scene = composer.getScene(currentScene) -- scene:onRewardComplete() -- end -- end -- The user clicked/tapped an ad elseif ( event.phase == "clicked" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad clicked/tapped" ) -- The ad failed to load elseif ( event.phase == "failed" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad failed to load" ) -- The ad event data received elseif ( event.phase == "dataReceived" ) then print( "Appodeal event: " .. tostring(event.type) .. " ad returned data : " .. tostring(event.data) ) end end
GDPR handler and init() call:
-- -- call EEA/GDPR consent handler -- fOpen.loadStateFile() global.userConsent = global.gameState[global.GDPR].userConsent local consentDate = global.gameState[global.GDPR].userConsentDate local markDate = "01-01-2100" -- --print("BASE: consentDate: ",consentDate) today = os.date("%m-%d-%Y") --print("BASE: consentDate: ",consentDate) --print("BASE: today: ",today) --print("main: appKey: ",appKey) if ( consentDate == markDate) then ---- print("main: calling privacyPolicy") composer.gotoScene("scenes.privacyPolicy",{time = 1500, effect = "crossFade" }) ---- print("main: userConsent is: ",global.userConsent) ---- Initialize the Appodeal plugin appodeal.init( adListener, { appKey=appKey, supportedTypes = {"interstitial"}, hasUserConsent = global.userConsent, } ) -- how to get data to appodeal? [in a parameter in the initialize() call elseif ( consentDate ~= markDate) then appodeal.init( adListener, { appKey=appKey, supportedTypes = {"interstitial"}, hasUserConsent = global.userConsent,}) -- hasUserConsent = global.userConsent, testMode = true, supportedTypes = {"interstitial"}} ) -- normal init, consent already set --print("in main calling splash: ") composer.gotoScene( "scenes.splashScreen", {time = 333, effect = "crossFade" })
What I get in console:
18:32:39.392 appodeal.init() WARNING: The Appodeal plugin is only supported on Android and iOS devices. Please build for device
18:41:49.007 before ad: count is: 6
18:41:49.007 calling ad
18:41:49.007 appodeal.isLoaded() WARNING: The Appodeal plugin is only supported on Android and iOS devices. Please build for device
As you can see no listener info and no show() call even though the isLoaded() check passes, see code below. Or does it?
The overall changes to the code were minimal when putting in the GDPR code. Ads were functioning fine until then. This is the only call made in the code other than the init() call, this happens when the player completes every 3rd game and they are exiting the score review scene.
if (global.gamesPlayed % 3 == 0) then print("calling ad") if (appodeal.isLoaded("interstitial")) then print("is loaded") appodeal.show("interstitial") end end