appodeal.getRewardParameters()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, Appodeal, getRewardParameters
See also appodeal.*

Overview

Returns the reward parameters for the specified placement ID with an event.phase of "dataReceived". The data returned is formatted as a JSON string in event.data.

Syntax

appodeal.getRewardParameters( [placementId] )
placementId (optional)

String. The placement ID for which to return reward parameters. If no placement ID is given, the default placement will be used.

Example

local appodeal = require( "plugin.appodeal" )

local function adListener( event )

    if ( event.phase == "init" ) then  
    -- Successful initialization

  elseif ( event.phase == "failed" ) then  -- The ad failed to load
        print( event.type )
        print( event.isError )
        print( event.response )

  elseif ( event.phase == "dataReceived" ) then  -- Event data received
        print( event.type )
        print( event.data )
    end
end

-- Initialize the Appodeal plugin
appodeal.init( adListener, { appKey="YOUR_APP_KEY" } )

-- Sometime later, get the reward parameters for the default placement
appodeal.getRewardParameters()