Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Ads only show up once
Started by vserrato129 Jan 14 2018 03:21 AM

5 replies to this topic
ads monetization appodeal adnoob
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

vserrato129

[GLOBAL: userInfoPane.html]
vserrato129
  • Enthusiast

  • 36 posts
  • Corona SDK

Hello so I am making a game and when I load up my app for the first time an ad popups after I lose a banner never seems to appear.

 

I am using Appodeal. 

 

This is in my game.lua 

 

I tried looking on Appodeal for more help because I feel like I must be doing something incorrect.

local appodeal = require("plugin.appodeal")


local function adListener( event )
 
    if ( event.phase == "init" ) then  -- Successful initialization
        -- Show a banner ad
        appodeal.show( "banner" , {yAlign = "bottom"})
        print("ad")
 
    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="MYKEY" } )

-- Sometime later, check if an ad is available
if ( appodeal.isLoaded( "banner" ) ) then
    appodeal.show( "banner" )
end
 
-- Sometime later, hide the ad
appodeal.hide( "banner" )

I use to use Admob and had no problem. I am also wondering if I have add something to my main.lua file?

 

Any help would be amazing, this ad problem is the only thing stopping me from releasing my game.



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,917 posts
  • Corona Staff

You have to explicitly call the .show() method when you want to show a banner ad After you call .hide() no banner will show again until you call .show().

 

Rob



[TOPIC: post.html]
#3

vserrato129

[GLOBAL: userInfoPane.html]
vserrato129
  • Enthusiast

  • 36 posts
  • Corona SDK

So after loading an Ad if there is any , I call the .hide() then I call .show() again right 

-- Call ad

appodeal.show("banner" , {yAlign = "bottom"}

Something like this? Just want to be sure if that is what you mean



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,917 posts
  • Corona Staff

I would not call .show() in the listener function. I would maybe set a flag there saying that init is complete, but I would defer calling .show() until you are ready to show the ad. That way you're not having to hide it right away.

 

Rob



[TOPIC: post.html]
#5

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 622 posts
  • Corona SDK

Just delete the hide banner call.



[TOPIC: post.html]
#6

vserrato129

[GLOBAL: userInfoPane.html]
vserrato129
  • Enthusiast

  • 36 posts
  • Corona SDK

Thanks will try! Haven't been home all day so i will try it (:




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: ads, monetization, appodeal, adnoob