类型 函数 返回值 无 修订 版本 2024.3703 关键词 广告, Appnext, setRewardsTransactionId 另请参阅 appnext.getRewardsTransactionId() appnext.*
仅影响激励视频广告。为每个广告视图设置一个交易 ID。请确保这是一个**唯一**的奖励 ID。
appnext.setRewardsTransactionId( adKey, rewardsTransactionId )
字符串.先前创建的广告返回的广告密钥。
字符串.要发送给广告的奖励交易 ID。
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 rewardedPlacementID
local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
rewardedPlacementID = "YOUR_IOS_REWARDED_PLACEMENT_ID"
elseif ( platform == "Android" ) then
rewardedPlacementID = "YOUR_ANDROID_REWARDED_PLACEMENT_ID"
end
local rewardedAdKey = appnext.createAd( "rewarded", rewardedPlacementID )
appnext.setRewardsTransactionId( rewardedAdKey, "YOUR_REWARDS_TRANSACTION_ID" )