startapp.isLoaded()

类型 函数
返回值 布尔值
修订版 2024.3703 版本
关键词 广告、广告宣传、StartApp、isLoaded
另请参见 startapp.show()
startapp.*

概述

返回布尔值,指示是否已加载广告并已可以展示。

语法

startapp.isLoaded( 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" } )

-- Sometime later, check if the ad is loaded
print( startapp.isLoaded( "interstitial" ) )