Appodeal ad not showing

When I put my code to show an appodeal interstitial ad , nothing happens . I have tested it on an android phone but nothing happens . Can I get some help ?

sidebar.lua :

local appodeal = require( "plugin.appodeal" ) -- background local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="c6e5e59f5c0a2860b5c2c9183dc9af5f" } ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad appodeal.show( "interstitial", { yAlign="top" } ) 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="c6e5e59f5c0a2860b5c2c9183dc9af5f" } )

build.settings

settings = { orientation = { default = 'landscapeRight', supported = {'landscapeLeft', 'landscapeRight'} }, android = { installLocation = 'auto', usesPermissions = {}, supportsTV = true, isGame = true, largeHeap = true, usesFeatures = { {name = 'android.hardware.gamepad', required = false} }, mainIntentFilter = { categories = {'tv.ouya.intent.category.GAME'} } }, iphone = { iCloud = true, plist = { CFBundleIconFiles = { 'Icon.png', 'Icon@2x.png', 'Icon-Small-40.png', 'Icon-Small-40@2x.png', 'Icon-60.png', 'Icon-60@2x.png', 'Icon-60@3x.png', 'Icon-72.png', 'Icon-72@2x.png', 'Icon-76.png', 'Icon-76@2x.png', 'Icon-Small-50.png', 'Icon-Small-50@2x.png', 'Icon-Small.png', 'Icon-Small@2x.png' }, UIPrerenderedIcon = true, UILaunchStoryboardName = 'launchscreen', UIBackgroundModes = {'remote-notification'}, UIApplicationExitsOnSuspend = false }, skipPNGCrush = true }, tvos = { iCloud = true, icon = { small = { -- A collection of 400x240 images, in order from top to bottom 'Icon-tvOS-Small-4.png', 'Icon-tvOS-Small-3.png', 'Icon-tvOS-Small-2.png', 'Icon-tvOS-Small-1.png' }, large = { -- A collection of 1280x768 images, in order from top to bottom 'Icon-tvOS-Large-4.png', 'Icon-tvOS-Large-3.png', 'Icon-tvOS-Large-2.png', 'Icon-tvOS-Large-1.png' } }, topShelfImage = 'Icon-tvOS-TopShelf.png', -- 1920x720 topShelfImageWide = 'Icon-tvOS-TopShelfWide.png', -- 2320x720 launchImage = 'Icon-tvOS-Launch.png' -- 1920x1080 }, osx = { iCloud = {['kvstore-identifier'] = 'com.coronalabs.coronacannon'}, plist = {NSHumanReadableCopyright = 'Copyright 2016 © Corona Labs, Inc.'} }, window = { defaultMode = 'fullscreen', defaultViewWidth = 1280, defaultViewHeight = 720, minViewWidth = 1280, minViewHeight = 720, --enableMaximizeButton = true, --resizable = true, titleText = {default = 'Ball Launcher'} }, plugins = { ['plugin.iCloud'] = {publisherId = 'com.coronalabs', supportedPlatforms = {iphone = true, appletvos = true, ['iphone-sim'] = true, osx = true}}, ['plugin.bit'] = {publisherId = 'com.coronalabs'} , ["plugin.appodeal"] = { publisherId = "com.coronalabs" },-- Needed for Tiled loader }, excludeFiles = { all = { 'Banner-\*.png', 'Icon-\*dpi.png', 'Icon-ouya-xiaomi.png', 'Icon-ouya.png', 'Icon-tvOS-\*.png', '\*.icns', '\*.ico', 'icon1024.png', 'icon1024-iOS.png', 'key.der', '\*.keystore', 'maps/\*.tmx', 'prepare\_icons.sh'} } } local iPhoneIcons = {} for i = 1, #settings.iphone.plist.CFBundleIconFiles do iPhoneIcons[i] = settings.iphone.plist.CFBundleIconFiles[i] end iPhoneIcons[#iPhoneIcons + 1] = '\*.nib' iPhoneIcons[#iPhoneIcons + 1] = 'Default-\*.png' iPhoneIcons[#iPhoneIcons + 1] = 'iTunes\*' settings.excludeFiles.tvos = iPhoneIcons settings.excludeFiles.android = iPhoneIcons settings.excludeFiles.osx = iPhoneIcons settings.excludeFiles.win32 = iPhoneIcons

FYI. Most errors are reported in the device log when you run your app. It’s recommended to check the device log as it usually contains helpful information which can identify problems when things go wrong.

Here are some items to check:

First of all make sure the package id of your app (Example: com.company.appname) in your Appodeal dashboard is exactly the same as what you’re using in your Corona app.

There are also a few things wrong with the code you posted above.

  1. You have 2 functions called adListener. You should only have one.
  2. You’re trying to call appodeal.init() twice. It should only be called once within the lifetime of the app, preferably in main.lua.
  3. There is no yAlign option for interstitials.
  4. While developing your app you should use testMode=true. Live ads will most likely fail when registering new apps (see explanation below). You set test mode when calling init: 
    appodeal.init( adListener, { appKey=“YOUR_KEY”, testMode=true } )

Some general thoughts:

Before your app goes live it’s recommended that you contact Appodeal and tell them about your app so they can “flip the switch” on the mediated ad networks and make sure your app gets proper ads quickly. It’s not entirely necessary to contact them, however if you don’t it will take some time before their mediation system learns about your app so that it can start serving relevant live ads.

Appodeal is a mediation platform which works by letting all participating ad networks compete against each other in real time where the highest bidder wins the impression. For this system to be effective you need more than 10 thousand impressions per day. If you have less than that you might not see any real benefits from using Appodeal mediation as opposed to a standalone ad network plugin.

So it should look like this ? 

main.lua(not all my code) :

local appodeal = require( "plugin.appodeal" ) appodeal.init( adListener, { appKey="appkey", testMode=true} )

All other scenes I want to show an appodeal ad on :

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad appodeal.show( "interstitial", { yAlign="top" } ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) end end

No, adListener should be in main.lua too (remove appodeal,show() from the listener).

When you want to show an ad you simply call appodeal.show(“interstitial”) in your scene.

Main.lua :

local appodeal = require( "plugin.appodeal" ) appodeal.init( adListener, { appKey="c6e5e59f5c0a2860b5c2c9183dc9af5f", testMode=true} ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad appodeal.show( "interstitial", { yAlign="top" } ) 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 :

-- requires local appodeal = require( "plugin.appodeal" ) local composer = require( "composer" ) local scene = composer.newScene() -- background appodeal.show("interstitial") 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 ..... .....

Like that ?

Ingemar asked you remove the appodeal.show() call in this block of code:
 

local appodeal = require( "plugin.appodeal" ) appodeal.init( adListener, { appKey="c6e5e59f5c0a2860b5c2c9183dc9af5f", testMode=true} ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Show a banner ad appodeal.show( "interstitial", { yAlign="top" } ) --\<------ take this line out.... 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")

Then in this block of code:

local appodeal = require( "plugin.appodeal" ) local composer = require( "composer" ) local scene = composer.newScene() -- background appodeal.show("interstitial") --\<-------- move this to scene:show()'s "did" phase 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

For Composer scene files, if you put appodeal.show() where you are, the next time the scene loads, it may not run. It’s best to do this in scene:show()'s “did” phase.

Rob

Thanks for the help guys .

Would it make sense if I put 

appodeal.hide( “interstitial” )

In the game.lua file so the ad doesn’t show during the game ?

Or should I leave it alone ?

That depends on your code. If you show the interstitial ad, it covers the whole screen and the user has to tap to close it. They would not be able to get to the game scene without being able to interact with buttons behind the ad… unless you have a timer or something that automatically goes to the game level. If you do that, you would need to call the hide() call. But in most cases, you won’t need to hide an interstitial ad. It’s mostly for banner ads.

Rob

Thanks

Please keep in mind, as per the documentation, you cannot call hide() on interstitials and rewarded videos.
https://docs.coronalabs.com/plugin/appodeal/index.html

You should only call show() when it’s safe to show an ad.
Preferably you should also call isLoaded() to check if an ad is available.

The ads don’t show on my phone . Do I have to take test mode off ?

Do i need to take it off test mode to see the ad ?

No you should leave testMode on.
If you don’t see ads, please check your device log. Most times there are messages there that explain why ads are not diplayed.

Here’s a guide about debugging in Corona.
https://docs.coronalabs.com/guide/basics/debugging/index.html

This is what I have :

start.lua :

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") background:addEventListener("touch", start) end end

main.lua:

local appodeal = require( "plugin.appodeal" ) appodeal.init( adListener, { appKey="appkey", 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

The only thing coming out of my console log is :

appodeal.init() WARNING: The Appodeal plugin is only supported on Android, iOS and tvOS devices. Please build for device show started show showing objects appodeal.show() WARNING: The Appodeal plugin is only supported on Android, iOS and tvOS devices. Please build for device

But I tried it out on my android phone and nothing showed . (I used the right app key)

Why is your listener empty?  You can’t see what’s going on if you don’t add debug code to it…

This is a broad start.   You can improve from there.  My guess is you’re not waiting for init to complete before trying to show an add, but without any debug code how can you know what is happening?

local function adListener( event ) for k,v in pairs( event ) do print( k, v ) end print( "---------------------------", system.getTimer() ) end

Also, your code is in the wrong order…

Do this…

local appodeal = require( "plugin.appodeal" ) -- NOT HERE... -- -- adListener hasn't been defined yet.. how do you expect it to be called? --appodeal.init( adListener, { appKey="appkey", testMode=true} ) local function adListener( event ) for k,v in pairs( event ) do print( k, v ) end print( "---------------------------", system.getTimer() ) end -- NOW DO IT... appodeal.init( adListener, { appKey="appkey", testMode=true} )

This is what I have and my console.log is still printing the same thing from before :

main.lua :

local appodeal = require( "plugin.appodeal" ) local function adListener( event ) for k,v in pairs( event ) do print( k, v ) end print( "No ads", system.getTimer() ) end appodeal.init( adListener, { appKey="appkey", testMode=true} ) local composer = require( "composer" ) composer.gotoScene("start")