RevMob Hide/Show Issue

I’m trying to have a banner show in one scene but be hidden in another. I’m able to get the banner to show at first and then hide when I go to the next scene… but when I return back to the scene where I want the banner to show again it won’t. I use this to show the ad:

[lua]
local revmob = require( “plugin.revmob” )

local placementID = “My_ID”

local function adListener( event )

    if ( event.phase == “sessionStarted” ) then  – Successful initialization

        – Load a RevMob ad

        revmob.load( “banner”, placementID )

    elseif ( event.phase == “loaded” ) then  – The ad was successfully loaded

        – Show the ad

        revmob.show( placementID, { yAlign=“bottom” } )

    end

end

– Initialize RevMob

revmob.init( adListener, { appId=“My_AppID” } )

[/lua]

I use this to hide the ad when leaving the scene:

[lua]

revmob.hide( placementID )

[/lua]

The banner doesn’t return to the scene when it’s reloaded for some reason.

Generally speaking, our sample code for ads isn’t designed for production use, just for testing use. If you want to control when you show ads, do you do by calling revmob.show() at the point in your code where you want to show the ad, not immediately upon the ad loading which was triggered by the ad module initializing. 

In the scene where you want it to show, call revmob.show() in the scene’s scene:show()'s “did” phase. Call revmob.hide() in scene:hide()'s “will” phase. 

Now I don’t know if revmob needs to call .load() to get a new ad or not, but if so, after you call .show() you can then call .load() to preload the next ad.

Rob

Generally speaking, our sample code for ads isn’t designed for production use, just for testing use. If you want to control when you show ads, do you do by calling revmob.show() at the point in your code where you want to show the ad, not immediately upon the ad loading which was triggered by the ad module initializing. 

In the scene where you want it to show, call revmob.show() in the scene’s scene:show()'s “did” phase. Call revmob.hide() in scene:hide()'s “will” phase. 

Now I don’t know if revmob needs to call .load() to get a new ad or not, but if so, after you call .show() you can then call .load() to preload the next ad.

Rob