startapp.load()

类型 函数
返回值
修订版 发行版 2024.3703
关键字 广告、StartApp、加载
参见 startapp.show()
startapp.*

概述

预加载一个 StartApp 广告以便在未来调用 startapp.show() 时显示。您还可以调用 startapp.isLoaded() 来验证该广告是否已加载。

语法

startapp.load( adType )
adType (必需)

字符串. 以下值之一:"插页式广告""视频""奖励视频""推荐墙"

示例

local startapp = require( "plugin.startapp" )

local function adListener( event )
    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
        -- Load an StartApp ad
        startapp.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 )
    end
end

-- Initialize the StartApp plugin
startapp.init( adListener, { appId="Your App ID" } )