appnext.setCategories()

类型 函数
返回值
修订版 发行 2024.3703
关键字 广告,广告宣传,Appnext,setCategories
另请参阅 appnext.getCategories()
appnext.*

概述

设置首选的广告类别。

语法

appnext.setCategories( adKey, categories )
adKey (必需)

String. 为先前创建的广告返回的广告密钥。

categories (必需)

String. 要为广告设置的首选类别。

示例

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.setCategories( interstitialAdKey, "Action, Adventure" )