Hello, I’m trying to get an interstitial ad to show up as soon as it’s ready to be shown but I am having some troubles. I know it can work, because previously I had it showing up if admob banner doesn’t work (just practicing with it). But now I’m giving it it’s own function separate from admob but I can’t for the life of me get it to show up. If anyone can help me with my code or even suggest an easier way then I’ll really appreciate it!
P.S. event.isError was something I pulled from my admob function that I’ll eventually take out because I know chartBoost doesn’t use it.
Thanks!
[lua]
local function chartBoostListener( event )
print (“chartBoostListener Called”)
if ( event.isError ) then
else
print (“Here!! *******”) --*This is weirdly where terminal stops. Last line doesn’t show up, and no errors come up
print (“has cached interstitial?”…chartboost.hasCachedInterstitial())
if chartboost.hasCachedInterstitial() then
print(“Chartboost has cached ad”)
chartboost.show( “interstitial” )
print (“Here2!!! *******”)
else
print (“test mark”)
chartBoostListener()
print (“test mark 2”)
end
end
– for k, v in pairs( event ) do
– print( tostring(k)… “=”… tostring(v) )
--end
end
—ads.init( adProvider, appID, adListenerFunction )
–ads.show( “banner”, { x=0, y=100000, appId=bannerAppID } )
–ads.show( “interstitial”, { appId=interstitialAppID } ) – uncomment this when you get banner to work
local chartboost = require( “plugin.chartboost” )
print (“placeholder 1”)
chartboost.init {
appID = “54dff5ed43150f0f55d0000a”, --I changed these b/c I’m assuming I shouldn’t share it?
appSignature = “22d7ec10c4d220a1c4f46b6fe19b9a834c000000”,
listener = chartBoostListener
--change listener to adListenerFunction
}
–chartboost.startSession( “54dff5ed43150f0f55d4639a”, “22d7ec10c4d220a1c4f46b6fe19b9a834c0f3d8d” ) --(appID, appSignature)
–chartboost.show( “interstitial”, “Startup” )
chartboost.cache( “interstitial” )
print (“chartboost was told to be cached****”)
local function systemEvent( event )
local phase = event.phase
print (“systemEventfunction*******”)
if event.type == “applicationResume” then
– Start a ChartBoost session after screen comes back from idle? and accurately allows chartboost to manage impressions/click rates
print (“Start Chartboost session ******”)
chartboost.startSession( “54dff5ed43150f0f55d4639a”, “22d7ec10c4d220a1c4f46b6fe19b9a834c0f3d8d” )
--chartboostFunction()
end
return true
end
Runtime:addEventListener( “system”, systemEvent )
[/lua]
Terminal:
[lua]
> Class.forName: plugin.chartboost.LuaLoader
V/Corona ( 9531): < Class.forName: plugin.chartboost.LuaLoader
Loading via reflection: plugin.chartboost.LuaLoader
I/Corona ( 9531): placeholder 1
I/Corona ( 9531): chartboost was told to be cached****
systemEventfunction*******
I/Corona ( 9531): chartBoostListener Called
I/Corona ( 9531): Here!! *******[/lua]