类型 函数 返回值 none 修订版 发行版 2024.3703 关键字 广告、广告宣传、Appnext、setPreferredOrientation 另请参见 appnext.getPreferredOrientation() appnext.*
设置首选方向,假设应用程序支持横向和纵向两种模式。
appnext.setPreferredOrientation( adKey, preferredOrientation )
字符串. 先前创建的广告返回的广告密钥。
字符串. 要为广告设置的首选方向。可能的值是 "automatic"、"landscape" 和 "portrait""automatic")
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.setPreferredOrientation( fullscreenAdKey, "landscape" )