Appodeal ad not showing

Do I really need to do the example ed showed me or can I do it the way you guys showed ?

You can do anything you want…

… but if you haven’t even verified your credentials are working with a known working example, then you have no idea if the problem is your credentials or your code.

I told you to use your credentials in the known working example because that is what a professional would do when testing.  Work from a known position and verify individual parts of the problem.

Okay I’ll try it now .

Thanks.  

This gives anyone helping you a starting point too.  

IF IT WORKS -  If you test with a known working example and your credentials check out, then they can move on to additional debug steps related to your program.

IF IT DOESN’T WORK -  If the credentials don’t work, then having access to a known working example gives the helper(s) the ability to suggest exact debug steps.

I was trying to link my admob account and appodeal account and I’ve been stuck on this screen for about 2 hours now .

No ads show at allll 

main.lua :

local appodeal = require( "plugin.appodeal" ) appodeal.init( adListener, { appKey="09e6c681ff134a85e448de94d693efa0fbbe231bca7d0e40", testMode=true} ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end local composer = require( "composer" ) composer.gotoScene("start")

start.lua:

local appodeal = require( "plugin.appodeal" ) function scene:show(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print("show started") elseif ( phase == "did" ) then print("show showing objects") appodeal.show("interstitial") --\<-------- move this to scene:show()'s "did" phase background:addEventListener("touch", start) end end

Hello any help ?

Is your app really at a point you need to add in Ads? I would consider this one of the last things you want to add in because you will be seeing them as you develop your app. You seem to have multiple apps in production so it’s really hard to judge where you are with them.

Now that said, you do have a problem in main.lua.  You try to tell the .init() function about your listener function when it doesn’t exist yet. Remember Lua is a one pass compiler and you have to define/write things before you can address them. This is that pesky “scope” issue.

local appodeal = require( "plugin.appodeal" ) local json = require( "json" ) local composer = require( "composer" ) local function adListener( event ) print( json.prettify( event ) ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad composer.setVariable( "adsReady", true ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end appodeal.init( adListener, { appKey="09e6c681ff134a85e448de94d693efa0fbbe231bca7d0e40", testMode=true} ) composer.gotoScene("start")

Notice how I changed the order of the adListener function and the .init(). I also added in a print statement to dump the results of the event table to the console log so you can see what errors you’re getting.  

Your code jumps immediately to “start.lua”. There is a good chance that appodeal.init() isn’t finished yet and you won’t be able to show an ad until it completes. Do you really want a full screen ad to be the very first thing your users see? Or are you just trying to build a test case?  

I also moved requiring Composer to the top. You should really try and group all your requires at the top of your code. By doing this I can use composer.setVariable() to define a variable that will let your other scenes know when initialization is complete.

Your start scene really needs to do some work before you start trying to load and show ads.

Lets make these changes and see what messages are printing to your console.log.

Rob

I did everything I was suppose to in the start scene :

-- requires local appodeal = require( "plugin.appodeal" ) local composer = require( "composer" ) local scene = composer.newScene() -- background function scene:create(event) local screenGroup = self.view background = display.newImageRect("start.jpg",display.contentWidth,display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY screenGroup:insert(background) end local options = { effect = "fade", time = 400, } function start( event ) if event.phase == "began" then composer.gotoScene("game", options) end end function scene:show(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print("show started") elseif ( phase == "did" ) then print("show showing objects") appodeal.show("interstitial") --\<-------- move this to scene:show()'s "did" phase background:addEventListener("touch", start) end end function scene:hide(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print("hide started") composer.removeScene( "start" ) elseif ( phase == "did" ) then print("hide removing objects") appodeal.show("interstitial") --\<-------- move this to scene:show()'s "did" phase background:removeEventListener("touch", start) end end function scene:destroy(event) end scene:addEventListener("create", scene) scene:addEventListener("show", scene) scene:addEventListener("hide", scene) scene:addEventListener("destroy", scene) return scene

when i run the app on my phone , I only get the loading sign and that’s it.

I just saw the ad take up about 3 quarters of the screen and only show for about 3 seconds .

Brandon, when people respond to your posts are you just copy/pasting the code or are you reading all the text?

I ask because I asked a couple of questions that didn’t get answered. Also there is a line of code in start.lua that you were asked to “move” but it looks like you copied the line and didn’t remove the line from where it doesn’t belong.

Finally, I had you put in code that would output messages to the device’s console log. Do you know how to read that information? You can’t trouble shoot these problems until you learn how to do that.

Are you on a Mac or Windows? 

Rob

Yes I have two apps that are finished and ready to launch that’s why I want to add in the ads now . When I’m going live , all I have to do is take of testMode = true to show the real ads and not test ones ?

Correct

Thanks .