appnext.getRewardsCustomParameter()

Type Function
Return value String
Revision Release 2024.3703
Keywords ads, advertising, Appnext, getRewardsCustomParameter
See also appnext.setRewardsCustomParameter()
appnext.*

Overview

Relevant for rewarded ads only. Gets the previously set custom parameter value/data for the ad.

Syntax

appnext.getRewardsCustomParameter( adKey )
adKey (required)

String. The ad key returned for a previously created 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.setRewardsCustomParameter( rewardedAdKey, "YOUR_REWARDS_CUSTOM_PARAMETER" )

print( "Custom parameter: " .. appnext.getRewardsCustomParameter( rewardedAdKey ) )