类型 函数 返回值 布尔值 修订 版本 2024.3703 关键词 广告, Appodeal, isLoaded 另请参阅 appodeal.show() appodeal.*
检查指定广告类型的广告是否已加载。 默认情况下,Appodeal 会在后台自动缓存广告,因此通常无需在调用此方法之前加载广告。 但是,在调用 appodeal.init() 时,可以禁用自动缓存。
appodeal.isLoaded( adUnitType )
字符串. 您希望检查的广告类型。有效值包括 "banner"、"interstitial" 和 "rewardedVideo"。
local appodeal = require( "plugin.appodeal" )
local function adListener( event )
if ( event.phase == "init" ) then
-- Successful initialization
elseif ( event.phase == "failed" ) then -- The ad failed to load
print( event.type )
print( event.isError )
print( event.response )
end
end
-- Initialize the Appodeal plugin
appodeal.init( adListener, { appKey="YOUR_APP_KEY" } )
-- Sometime later, check if an ad is available
if ( appodeal.isLoaded( "interstitial" ) ) then
appodeal.show( "interstitial" )
end