adcolony.show()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, AdColony, show
See also adcolony.init()
adcolony.isLoaded()

Overview

Shows an AdColony video interstitial or rewarded video.

Note

Before calling this function, you must call adcolony.init() and ensure that the "init" event phase occurs.

Syntax

adcolony.show( zoneName )
zoneName (required)

String. The user-defined AdColony zone name to be displayed. Zone names should be specified in the call to adcolony.init().

Note

For developers migrating from the Corona Ads incarnation of the AdColony plugin, the following parameters have been removed from this new plugin:

  • params.prePopup and params.postPopup; these options are now specified during adcolony.load().

Example

local adcolony = require( "plugin.adcolony" )

-- AdColony listener function
local function adListener( event )

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

-- Initialize the AdColony plugin
adcolony.init( adListener,
    {
        appId = "YOUR_ADCOLONY_APP_ID",
        adZones = {
            interstitial = "YOUR_ADCOLONY_ZONE_ID_1",
            rewardedVideo = "YOUR_ADCOLONY_ZONE_ID_2"
        }
    })

-- Sometime later, show an ad
if ( adcolony.isLoaded( "interstitial" ) ) then
    adcolony.show( "interstitial" )
end