appodeal.show()

Type Function
Return value none
Revision Release 2022.3683
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().

Important

Appodeal SDK can’t show ads in offline mode! You will get "adsRequest" Event with phase "failed" If you call this method without internet connection.

Syntax

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

String. The type of ad you wish to display. Valid values include "banner", "interstitial", 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 allow you to separate ads impressions by places where it was shown. You can read more in Appodeal Knowledge base.

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" } )