Issues while adding Revmob Full Screen Ads in Corona

322 Views Asked by At

I have added full screen Ads in my application but when i click on the cross button on the full screen Ads to close the Ads page and simultaneously click on the Ads Page to open the test window it sometimes gives error message attempt to call method 'didRemoveListener' a nil value, i have added code what i am writing in my application below, Please help to sort out this problem, thanks...

local RevMob = require("revmob")
display.setStatusBar(display.HiddenStatusBar)

local fullscreen
local revmobListener

local storyboard = require "storyboard"    
local REVMOB_IDS = { 
    ["Android"] = "",
    ["iPhone OS"] = ""
}

RevMob.startSession(REVMOB_IDS)
RevMob.setTestingMode(RevMob.TEST_WITH_ADS)

local function ShowAds()
    fullscreen.RevMob.createFullscreen()
    RevMob.showFullscreen(revmobListener, REVMOB_IDS)
end

revmobListener=function(event)
if(event.type=="adClicked" then
    fullscreen:hide()
    storyboard.gotoScene("scenes.Scene1")
elseif event.type=="adClosed" then
    fullscreen:hide()
    storyboard.gotoScene("scenes.Scene1")
end

ShowAds()
1

There are 1 best solutions below

1
Bruno Domingues On

A way to solve it. Just accept the first touch.

local clicked = false
revmobListener=function(event)
if(event.type=="adClicked" and not clicked then
    fullscreen:hide()
    storyboard.gotoScene("scenes.Scene1")
    clicked = true
elseif event.type=="adClosed" and not clicked then
    fullscreen:hide()
    storyboard.gotoScene("scenes.Scene1")
    clicked = true
end