How to Integrate Appodeal?

Let me preface this by letting you know that I am still new at all of this (if you couldn’t tell). So I’ve tried looking at the documentation and video tutorials (the one supplied by Dr. Brian Burton is old and uses CoronaAds) and what not, but I’m just not understanding this integration process. Here’s how my game is structured: 1) main.lua - which all it has is:

local composer = require( "composer" ) -- Hide status bar display.setStatusBar( display.HiddenStatusBar ) -- Go to the menu screen composer.gotoScene( "menu" )

So, okay it leads me to the 2) menu.lua which contains my menu items such as the play button that will bring my to the game screen aka 3) game.lua. In addition there’s the button that leads me to the highscores screen aka the 4) highScores.lua. 

What I’m trying to accomplish: On the menu screen there should be a banner ad at the top, but when the player leaves the screen to go the the game, it disappears. In addition, I’d like an interstitial that goes from the highscore to the menu screen.

The problem: How do I do this? Looking at the documentation, changing the build.settings to add the plugin and bypass the ATS was easy enough. But afterwards for initialization, I have no idea where I should be putting it? I tried putting this:

local appodeal = require( "plugin.appodeal" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad appodeal.show( "banner", {yAlign="top", placement="testPlacement"} ) appodeal.show( "interstitial") elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="YOUR\_APP\_KEY", locationTracking = false, supportedAdTypes = {"banner", "interstitial"}, childDirectedTreatment = true, bannerAnimation = true, testMode = true 

in the menu and got a bunch of whatever errors and so I’m just very lost. Help would be appreciated, please don’t just refer me to the documentation. Thank you in advance!

local appodeal = require( "plugin.appodeal" )

Put this line in every .lua file where you will call the appodeal.* API’s including main.lua and in your example menu.lua.

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- maybe set a flag that you can see in all scenes to know that initialization is complete elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="YOUR\_APP\_KEY", locationTracking = false, supportedAdTypes = {"banner", "interstitial"}, childDirectedTreatment = true, bannerAnimation = true, testMode = true } )

This goes in main.lua.

Then in menu.lua  you would call appodeal.show() with the necessary parameters to show your banner.

Rob

local appodeal = require( "plugin.appodeal" )

Put this line in every .lua file where you will call the appodeal.* API’s including main.lua and in your example menu.lua.

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- maybe set a flag that you can see in all scenes to know that initialization is complete elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="YOUR\_APP\_KEY", locationTracking = false, supportedAdTypes = {"banner", "interstitial"}, childDirectedTreatment = true, bannerAnimation = true, testMode = true } )

This goes in main.lua.

Then in menu.lua  you would call appodeal.show() with the necessary parameters to show your banner.

Rob