Type Function Return value none Revision 2017.3060 Keywords ads, advertising, AdColony, init See also adcolony.load() adcolony.show()
adcolony.init()
initializes the AdColony plugin. This call is required and must be executed before making other AdColony calls such as adcolony.load() and adcolony.show().
adcolony.init( listener, params )
Listener. Listener function that will receive adsRequest events.
Table. Table containing AdColony initialization values — see the next section for details.
The params
table includes parameters for the AdColony initialization.
For developers migrating from the Corona Ads incarnation of the AdColony plugin, the following parameters have been removed from this new plugin:
apiKey
(replaced by appId
)testMode
; this is now set per-app in the AdColony dashboardTable. A table of key-value pairs containing your zones, as defined in the AdColony dashboard. Keys are interstitial
and rewardedVideo
since these names are what you'll use in calls to other functions within this plugin. The value for each
String. The preferred orientation in which you want the ads to be displayed. Valid values are "portrait"
and "landscape"
. Default is "landscape"
.
String. A unique user ID to be given to the current user.
Boolean. If true
, turns on debug logging which displays extra debugging information in the device log. Default is false
.
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" } })