applovin.hide()

类型 函数
返回值
修订版 版本 2024.3703
关键字 广告、广告宣传、AppLovin、隐藏
另请参见 applovin.init()
applovin.load()
applovin.isLoaded()
applovin.*

概述

隐藏 AppLovin 横幅广告。

备注

目前此方法仅支持 “banner” 广告。

语法

applovin.hide( "banner" )

示例

local applovin = require( "plugin.applovin" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
        -- Load an AppLovin ad
        applovin.load( "interstitial" )

    elseif ( event.phase == "loaded" ) then  -- The ad was successfully loaded
        print( event.type )

    elseif ( event.phase == "failed" ) then  -- The ad failed to load
        print( event.type )
        print( event.isError )
        print( event.response )

    elseif ( event.phase == "displayed" or event.phase == "playbackBegan" ) then  -- The ad was displayed/played
        print( event.type )

    elseif ( event.phase == "hidden" or event.phase == "playbackEnded" ) then  -- The ad was closed/hidden
        print( event.type )

    elseif ( event.phase == "clicked" ) then  -- The ad was clicked/tapped
        print( event.type )
    end
end

-- Initialize the AppLovin plugin
applovin.init( adListener, { sdkKey="YOUR_SDK_KEY" } )

-- Sometime later, show the ad
local isAdLoaded = applovin.isLoaded( "interstitial" )
if ( isAdLoaded == true ) then
    applovin.show( "interstitial" )
end

-- Sometime later, hide the ad
applovin.hide( "banner" )