@Mo
I noticed that chartboost ads do not re-appear if the user closes the interstitial. So I intialize chartboost in the module itself.
local M = {} -- you can add the below code in a separate function too, but i prefer not to. M.ads = require "ads" M.provider = "vungle" M.appIdVungle = "VUNGLE\_ID" M.cbdata = require "ChartboostSDK.chartboostdata" M.cb = require "ChartboostSDK.chartboost" M.appId = "CHARTBOOST\_ID" M.appSignature = "APP\_SIG" M.appBundle = "BUNDLE" M.appVersion = "VERSION" --ADD YOUR REVMOB CODE HERE----- --M.tapfortap = require "plugin.tapfortap" --M.tapfortap.initialize("TFP\_ID") ------------------------------------------------------------ M.delegate = { shouldRequestInterstitial = function(location) print("Chartboost: shouldRequestInterstitial " .. location .. "?"); return true end, shouldDisplayInterstitial = function(location) print("Chartboost: shouldDisplayInterstitial " .. location .. "?"); return true end, didCacheInterstitial = function(location) print("Chartboost: didCacheInterstitial " .. location); return end, didFailToLoadInterstitial = function(location) print("Chartboost: didFailToLoadInterstitial " .. location); return end, didDismissInterstitial = function(location) print("Chartboost: didDismissInterstitial " .. location); return end, didCloseInterstitial = function(location) print("Chartboost: didCloseInterstitial " .. location); return end, didClickInterstitial = function(location) print("Chartboost: didClickInterstitial " .. location); return end, didShowInterstitial = function(location) print("Chartboost: didShowInterstitial " .. location); return end, shouldDisplayLoadingViewForMoreApps = function() return true end, shouldRequestMoreApps = function() print("Chartboost: shouldRequestMoreApps"); return true end, shouldDisplayMoreApps = function() print("Chartboost: shouldDisplayMoreApps"); return true end, didCacheMoreApps = function() print("Chartboost: didCacheMoreApps"); return end, didFailToLoadMoreApps = function() print("Chartboost: didFailToLoadMoreApps"); return end, didDismissMoreApps = function() print("Chartboost: didDismissMoreApps"); return end, didCloseMoreApps = function() print("Chartboost: didCloseMoreApps"); return end, didClickMoreApps = function() print("Chartboost: didClickMoreApps"); return end, didShowMoreApps = function() print("Chartboost: didShowMoreApps"); return end, shouldRequestInterstitialsInFirstSession = function() return true end } M.cb.create{appId = M.appId, appSignature = M.appSignature, delegate = M.delegate, appVersion = M.appVersion, appBundle = M.appBundle} M.cb.startSession() function M.caching\_Ads() M.cb.cacheInterstitial() M.cb.cacheMoreApps() end M.caching\_Ads() function M.vungle\_init() M.ads.init( M.provider, M.appIdVungle, M.functionAdListener ) end function M.tfp\_prepare\_ad() M.tapfortap.prepareInterstitial() end function M.isVungleAvailable() if (type(M.ads.isAdAvailable) == "function") then return M.ads.isAdAvailable(); end return false; end function M.show\_vungle\_ad() if M.isVungleAvailable() then M.ads.show( "interstitial", { isBackButtonEnabled = true } ) else M.chartboost\_show\_ad() end return true end function M.functionAdListener() if event.type == "adStart" and event.isError then print("Vungle Error") end end function M.chartboost\_show\_more\_ad() if M.cb.hasCachedMoreApps() then local msg = "Chartboost: Loading More Apps From Cache" end print(msg) M.cb.showMoreApps() return true end function M.chartboost\_show\_ad() if M.cb.hasCachedInterstitial() then local msg = "Chartboost: Loading Interstitial From Cache" print(msg) M.cb.showInterstitial() else M.tapfortap.showInterstitial() end return true end return M
To init in main just do this
local myads = require(“myAds”)
myads.vungle_init()