Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 2.11 KB

getRewardsCustomParameter.markdown

File metadata and controls

59 lines (42 loc) · 2.11 KB

appnext.getRewardsCustomParameter()

 
Type Function
Library appnext.*
Return value String
Keywords ads, advertising, appnext, getRewardsCustomParameter
See also appnext.setRewardsCustomParameter()

Overview

Relevant for Rewarded ads only. Get the previously set custom parameter value / data for the ad.

Syntax

appnext.getRewardsCustomParameter( adKey )
adKey (required)

String. The adKey returned for a previously created ad.

Examples

local appnext = require 'plugin.appnext'

local function listener( event )
	print( "Received " .. event.event .. " for " .. event.adKey .. " with message " .. event.message )
end

-- Initialize the Appnext plugin
appnext.init( listener )

-- Create your Ads
local interstitialPlacementID
local fullscreenPlacementID
local rewardedPlacementID

local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
    interstitialPlacementID = "YOUR_IOS_INTERSTITIAL_PLACEMENT_ID"
    fullscreenPlacementID = "YOUR_IOS_FULLSCREEN_PLACEMENT_ID"
    rewardedPlacementID = "YOUR_IOS_REWARDED_PLACEMENT_ID"
elseif ( platform == "Android" ) then
    interstitialPlacementID = "YOUR_ANDROID_INTERSTITIAL_PLACEMENT_ID"
    fullscreenPlacementID = "YOUR_ANDROID_FULLSCREEN_PLACEMENT_ID"
    rewardedPlacementID = "YOUR_ANDROID_REWARDED_PLACEMENT_ID"
end

interstitialAdKey = appnext.createAd( "interstitial", interstitialPlacementID )
fullscreenAdKey = appnext.createAd( "fullscreen", fullscreenPlacementID )
rewardedAdKey = appnext.createAd( "rewarded", rewardedPlacementID )

appnext.setRewardsCustomParameter( rewardedAdKey, "YOUR_REWARDS_CUSTOM_PARAMETER" )
print( "Custom parameter:" .. appnext.getRewardsCustomParameter( rewardedAdKey ) )