appnext.setCloseDelay()

类型 函数
返回值
修订 版本 2024.3703
关键字 广告、广告宣传、Appnext、setCloseDelay
另请参阅 appnext.getCloseDelay()
appnext.*

概述

仅针对全屏和奖励广告生效。如果显示“关闭”按钮,将会延迟几秒显示该按钮。

语法

appnext.setCloseDelay( adKey, closeDelay )
adKey (必需)

字符串. 为先前创建的广告返回的广告密钥。

closeDelay (必需)

数字. 广告的“关闭”按钮的延迟显示时间。

示例

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 platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
    fullscreenPlacementID = "YOUR_IOS_FULLSCREEN_PLACEMENT_ID"
elseif ( platform == "Android" ) then
    fullscreenPlacementID = "YOUR_ANDROID_FULLSCREEN_PLACEMENT_ID"
end

local fullscreenAdKey = appnext.createAd( "fullscreen", fullscreenPlacementID )

appnext.setCloseDelay( fullscreenAdKey, 5.5 )