类型 函数 返回值 布尔值 修订版本 版本 2024.3703 关键词 广告, Appnext, getAutoPlay 另请参阅 appnext.setAutoPlay() appnext.*
仅与插页式广告相关。 指示视频是否会在
appnext.getAutoPlay( 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 interstitialPlacementID
local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
interstitialPlacementID = "YOUR_IOS_INTERSTITIAL_PLACEMENT_ID"
elseif ( platform == "Android" ) then
interstitialPlacementID = "YOUR_ANDROID_INTERSTITIAL_PLACEMENT_ID"
end
local interstitialAdKey = appnext.createAd( "interstitial", interstitialPlacementID )
appnext.setAutoPlay( interstitialAdKey, false )
if ( appnext.getAutoPlay( interstitialAdKey ) ) then
print( "AutoPlay is true" )
else
print( "AutoPlay is false" )
end