appodeal.show()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, Appodeal, show
See also appodeal.hide()
appodeal.*

Overview

Shows an Appodeal ad. By default, Appodeal automatically caches ads in the background, so there is normally no need to load ads in advance of calling this method. However, automatic caching may be disabled when calling appodeal.init().

Syntax

appodeal.show( adUnitType [, params] )
adUnitType (required)

String. The type of ad you wish to display. Valid values include "banner", "interstitial", "video", and "rewardedVideo".

params (optional)

Table. Table containing positioning parameters for banner ads — see the next section for details.

Parameter Reference

The params table can include properties for positioning a banner ad. This does not apply to interstitial or video ads.

yAlign (optional)

String. Vertical alignment of the banner. Valid options are "top" and "bottom". Default is "bottom.

placement (optional)

String. The placement you want the ad to be associated with. Placements are an advanced feature used together with "Segments" as defined in the Appodeal dashboard.

Example

local appodeal = require( "plugin.appodeal" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Show a banner ad
        appodeal.show( "banner", { yAlign="top" } )

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

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