Type Function Return value none Revision Release 2024.3703 Keywords ads, advertising, Appodeal, show See also appodeal.hide() appodeal.*
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().
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.
appodeal.show( adUnitType [, params] )
String. The type of ad you wish to display. Valid values include "banner"
, "interstitial"
, and "rewardedVideo"
.
Table. Table containing positioning parameters for banner ads — see the next section for details.
The params
table can include properties for positioning a banner ad. This does not apply to interstitial or video ads.
String. Vertical alignment of the banner. Valid options are "top"
and "bottom"
. Default is "bottom
.
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.
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" } )