Detecting Content Dismissed

Hello,

I am trying to integrate playhaven, but I’m having trouble detecting when the user closes the ad.

This is my code:

--PlayHaven Integration local playhaven = require "plugin.playhaven" local function playhavenListener(event) print("Event.Data: "..event.data) if event.data then event.data = json.decode(event.data) end local currentScene = storyboard.getCurrentSceneName() print("Event Status= "..event.status) print("Current Scene: "..currentScene) if event.data then print("Event.Data: "..json.encode(event.data)) end if event.status=="contentDidDisplay" then print("Ad Shown Successfully!") end if event.status=="contentDidDismissWithType" or event.status=="contentDidFail" then print("Event Status= "..event.status) print("Event Type: "..event.data.type) print("Current Scene: "..currentScene) print("I'm about to switch scenes!!!!!!!!") if currentScene=="gameLogic" then print ("Should be switching to loading screen") storyboard.gotoScene("loading", "fade", 200) end end end local init\_options if system.getInfo("platformName") == "Android" then init\_options = { token = "########################", secret = "#############################", closeButton = system.pathForFile("images/closeButton.png", system.ResourceDirectory), closeButtonTouched = system.pathForFile("images/closeButtonTouched.png", system.ResourceDirectory) } else init\_options = { token = "#################", secret = "#######################", closeButton = system.pathForFile("images/closeButton.png", system.ResourceDirectory), closeButtonTouched = system.pathForFile("images/closeButtonTouched.png", system.ResourceDirectory) } end local initPlayHaven = function() playhaven.init(playhavenListener, init\_options) end timer.performWithDelay(1000,initPlayHaven) 

When I close my ads, the logcat shows:
 

LuaLoader(PlayHaven) Should dispatchEvent -> contentDidDismissWithType

Nothing in the IF statement executes!

Also, randomly I get error messages such as:

Could not get interstitial because: Unable to resolve host: “api2.playhaven.com”: No address associated with hostname.

The latter is unrelated to the first error because even in the cases that it resolves normally it doesn’t trigger the IF statement.