appnext.setRewardsAmountRewarded()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, Appnext, setRewardsAmountRewarded
See also appnext.getRewardsAmountRewarded()
appnext.*

Overview

Effects rewarded video ads only. Sets the amount of currency to be rewarded.

Syntax

appnext.setRewardsAmountRewarded( adKey, rewardsAmountRewarded )
adKey (required)

String. The ad key returned for a previously created ad.

rewardsAmountRewarded (required)

String. The amount of currency to be sent for the ad.

Example

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.setRewardsAmountRewarded( rewardedAdKey, "YOUR_REWARDS_AMOUNT_REWARDED" )