I got around to fixing all my issues and released my app with this plugin in it, I would still like a .isCachedAdAvailable or have show return a bool or have a callback or something. I want users to trigger ads if they hit continue and to be able to respond if they don’t. Otherwise I have to have users hit continue twice. I don’t like ads that popup at random, I prefer to have them triggered by actions as it’s a better user experience. With hundreds of players daily I can’t afford to have a bad ad experience.
I never implemented the chartboost.startSession( yourAppID, yourAppSignature ); on resume events, but continued to get ads (although I’m not sure if I’m being credited) The online docs show chartboost.cache( appId, appSignature ) as an example, I guess there’s a mistake there. I will add it to see if anything changes
It’s important to keep caching ads if you fail, (if you go to airplane mode and come back for example) but the whole thing is now working from what I can tell
Here is how I worked around it, I really shouldn’t have had to do this if I had some indication of wether ads were available or not
local function chartboostListener( event ) print("CHARTBOOST EVENT") -- Print the events key/pair values for k,v in pairs( event ) do print( "CB " .. k .. " : " .. v ) end if event.name == "license" and event.status == "valid" then if(chartboostPlugin.getPluginVersion) then chartboostPlugin.cache() UIAds.chartBoostLive = true print("CHARTBOOST LIVE version " .. tostring(chartboostPlugin.getPluginVersion()) ) end end if(event.type == "interstitial" and UIAds.interstialFailCallback ~= nil ) then if(UIAds.chartBoostPluginFailTimer and (event.phase == "cached" or event.phase == "willDisplay") ) then print("CB showed the ad, Cancel interstial timer") timer.cancel(UIAds.chartBoostPluginFailTimer) UIAds.chartBoostPluginFailTimer = nil end if(event.phase =="failed" or event.phase == "closed") then print("callback fail or closed") if(UIAds.chartBoostPluginFailTimer ) then print("CB failed, Cancel interstial timer") timer.cancel(UIAds.chartBoostPluginFailTimer) UIAds.chartBoostPluginFailTimer = nil end UIAds.interstialFailCallback() UIAds.interstialFailCallback = nil if(event.phase == "closed") then lastInterstitialWas = "chartboost" end end end end local function showChartBoostInterstitial(callbackToContinueAfterAd) if( chartboostPlugin and UIAds.chartBoostLive == true) then print("CHARTBOOST SHOW ATTEMPT") UIAds.interstialFailCallback = callbackToContinueAfterAd -- timer to continue game because we did not show an ad UIAds.chartBoostPluginFailTimer = timer.performWithDelay(900,function() print("trigger CB fail timer") if(UIAds.interstialFailCallback) then print("call CB fail") if(chartboostPlugin) then chartboostPlugin.cache() end UIAds.interstialFailCallback() UIAds.interstialFailCallback = nil end end) chartboostPlugin.show( 'interstitial' ) return true end return false end
Before you make the Android version please add something to indicate there is no cached ad available, if it hasn’t already been added