admob.hide()

Type Function
Return value none
Revision Release 2022.3683
Keywords ads, advertising, AdMob, hide
See also admob.show()
admob.*

Overview

Only applies to banner ads. Removes any currently showing banner ad from the screen and prevents new banner ads from being retrieved until admob.show( "banner" ) is called again.

Syntax

admob.hide()

Example

local admob = require( "plugin.admob" )

-- AdMob listener function
local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Load an AdMob banner ad
        admob.load( "banner", { adUnitId="YOUR_ADMOB_AD_UNIT_ID" } )
        
    elseif ( event.phase == "loaded" ) then
        if ( event.type == "banner" ) then  -- Banner ad is loaded
            -- Show a banner ad
            admob.show( "banner" )
        end
    end
end

-- Initialize the AdMob plugin
admob.init( adListener, { appId="YOUR_ADMOB_APP_ID" } )

-- Sometime later, hide the banner
admob.hide()