类型 函数 返回值 无 修订版 2024.3703 版 关键词 广告、广告宣传、Appnext、loadAd 另请参阅 appnext.createAd() appnext.adIsLoaded() appnext.showAd() appnext.*
此函数用于加载和缓存之前使用 appnext.createAd() 创建的广告。
全屏广告和激励广告每次展示前必须加载。但是,插屏式广告不需要这通加载调用。
appnext.loadAd( adKey )
字符串. 从
local appnext = require( "plugin.appnext" ) local function adListener( event ) print( "Received " .. event.event .. " for " .. event.adKey .. " with message: " .. event.message ) end -- Initialize the Appnext plugin appnext.init( adListener ) -- Create your ads local fullscreenPlacementID local rewardedPlacementID local platform = system.getInfo( "platformName" ) if ( platform == "iPhone OS" ) then fullscreenPlacementID = "YOUR_IOS_FULLSCREEN_PLACEMENT_ID" rewardedPlacementID = "YOUR_IOS_REWARDED_PLACEMENT_ID" elseif ( platform == "Android" ) then fullscreenPlacementID = "YOUR_ANDROID_FULLSCREEN_PLACEMENT_ID" rewardedPlacementID = "YOUR_ANDROID_REWARDED_PLACEMENT_ID" end local fullscreenAdKey = appnext.createAd( "fullscreen", fullscreenPlacementID ) local rewardedAdKey = appnext.createAd( "rewarded", rewardedPlacementID ) -- Load your ads before showing appnext.loadAd( fullscreenAdKey ) appnext.loadAd( rewardedAdKey )