appodeal.load()

类型 函数
返回值
修订 版本 2024.3703
关键词 广告, Appodeal, 加载
另请参阅 appodeal.init()
appodeal.show()
appodeal.isLoaded()

概述

预加载 Appodeal 横幅广告、插屏广告或激励视频广告,以便在将来调用 appodeal.show() 时立即显示。

默认情况下,Appodeal 会在后台自动缓存广告,因此通常无需提前加载广告。要使用此函数,您必须关闭自动缓存,如 appodeal.init() 文档中所述。

语法

appodeal.load( adUnitType )
adUnitType (必填)

字符串有效值包括 "banner"(横幅广告)、"interstitial"(插屏广告)和 "rewardedVideo"(激励视频广告)。

示例

local appodeal = require( "plugin.appodeal" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Pre-load a static interstitial ad
        appodeal.load( "interstitial" )
    end
end

-- Initialize the Appodeal plugin
appodeal.init( adListener, { appKey="YOUR_APP_KEY", autoCacheAds=false } )