How to use the Vungle listener? Does it work?

@Sagarpawaskar Cool! That make sense.

Thanks.

Mo

@Mo glad you like that approach.

@ingemar I was wondering why do you check (type(ads.isAdAvailable)==function) for a function?

@sagarpawaskar

I do that so that I don’t get a runtime error when running in the Corona Simulator.

@ingemar attempt to call ads.isAdAvailable() a nil value? I’m getting this error… If I get this to work, there’s nothing else I’ve to look into.

If you test for it being a function before calling it (as I do) you’ll get around this :-).

However you should only run in to this problem on the Simulator. A device should have this function if the plugin has been able to initialize properly…

all good, thanks @ingemar that worked , will test this app once on the device.

@ingemar where do you init vungle - main or menu?

…on line #329 of the module I posted :slight_smile:

That code is automatically run when it’s 'require’d in my game module.

Hey all you Vungle users,

Has anyone figured out how to use the “incentivized” ad unit type from Vungle?  It seems to require server to server communication via callbacks and a username but the docs are sparse and none of the examples I’ve found show how to use it. Any ideas how to harness it using Corona?  Does it require backend infrastructure or can it be accessed using Corona alone?

@Sagarpawaskar: I am trying to use your module but I for some reason I am having problem with chartboost. for some reason it is not finding cb (nil) i am sure is because is the way i initialize the ad networks (for me Vungle, chartboost and Revmob. I am doing this in main.lua but I believe you are doing it on the game menu module. It is making me crazy! I really want to use a modular way so I do not crowed the main.lua Would you mind sharing your ad networks initialization code? Of course hide your  ad networks! That will show me maybe where my issue lies. I am still not yet clear on the use of external module using M table so I am missing something.

THANK YOU for any pointers :slight_smile:

Mo

ps: I can see also that @ingmar has all the init code inside the adnetworks.lua? But not all functions are added to the M table?

@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()

Just use a separate function for all the init data and call it in main. I don’t think you should have any prob with that.

You can add everything in M table, this is more efficient in terms of memory management. I also noticed that chartboost has a small memory leak.

I hope that helps resolve your issue:)

@Sagarpawaskar: You are the best! I will try it and get back to you.

Thank you so much for the taking the time!

Mo

@Mo, do you have texture memory issues with revmob? The reason m not using it, the texture memory rises to 20 mb when I include revmob sdk in my app, have you recently encountered anything like this?

I will check on that! I will check the current app code that is out and my new incoming app. It has been a while since I check for memory issues.

I will try to get back to you as soon as possible.

Mo

Thank you!!

You are welcome :slight_smile:

Humm…Is build server down? I am getting a “Null” when try to build?

Mo

EDIT: Stupid me, I tried another app and it is building fine. It seems that my current app has some issue. Sorry about the false alert :frowning:

@Sagarpawaskar: Something come up and now it is getting very late. i am sorry, I promised to look into the revmob issue (memory) tomorrow and get back to you! I hope it is ok.

Mo

@Mo sure no problem. I’m not in a hurry.

I’m not having an issue with the build server.

@Mo, I’ve got the revmob thing to work now. Got rid of tapfortap…

TFP: 3400 impressions, 72 taps and $0. Crazy… and tech support seems to be too busy to respond on time.