applovinMax.hide()

类型 函数
返回值
修订 版本 2024.3703
关键词 广告, AppLovin, AppLovin Max, 隐藏
另请参阅 applovinMax.init()
applovinMax.load()
applovinMax.isLoaded()
applovinMax.*

概述

隐藏 applovin 广告。

注意

目前,此方法仅支持 "banner" 横幅广告。

语法

applovinMax.hide( "banner" )

示例

local applovinMax = require( "plugin.applovinMax" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
        -- Load an AppLovin ad
        applovinMax.load( "banner", {iOSUnitId ="replace with your own", androidUnitId="replace with your own"} )

    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
applovinMax.init( adListener)

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

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