类型 函数 返回值 布尔值 修订 版本 2024.3703 关键词 广告, Chartboost, onBackPressed
返回当按下“返回”键时广告是否已关闭。这应该在你的按键处理函数中实现
chartboost.onBackPressed()
local chartboost = require( "plugin.chartboost" )
-- Called when a key event has been received
local function onKeyEvent( event )
if ( event.keyName == "back" and event.phase == "up" ) then
local platformName = system.getInfo( "platformName" )
if ( platformName == "Android" ) then
if ( chartboost.onBackPressed() ) then
-- Chartboost closed an active ad
return true -- Don't pass the event down the responder chain
end
end
end
-- IMPORTANT! Return false to indicate that this app is NOT overriding the received key
-- This lets the operating system execute its default handling of the key
return false
end
-- Add the key event listener
Runtime:addEventListener( "key", onKeyEvent )