vungle.load()

Type Function
Return value Boolean
Revision Current Public Release (2018.3326)
Keywords ads, advertising, Vungle
See also vungle.init()
vungle.*

Overview

vungle.load() begins loading a placement video ad. This method is only needed for placements other than the auto-cached one because auto-cached ads are loaded immediately after playing the pre-cached ad.

This API returns a boolean true if loading is successful, false otherwise.

Syntax

vungle.load( placementID )
placementID (required)

String. The placement ID of the ad to load.

Example

local vungle = require( "plugin.vungle" )

local appID, placementID1, placementID2
if ( system.getInfo("platform") == "android" ) then
    appID = "YOUR_ANDROID_APP_ID"
    placementID1 = "YOUR_ANDROID_PLACEMENT_ID_1"
    placementID2 = "YOUR_ANDROID_PLACEMENT_ID_2"
else
    appID = "YOUR_IOS_APP_ID"
    placementID1 = "YOUR_IOS_PLACEMENT_ID_1"
    placementID2 = "YOUR_IOS_PLACEMENT_ID_2"
end

-- Vungle listener function
local function adListener( event )

    if ( event.type == "adInitialize" ) then  -- Successful initialization
        print( event.provider )
    end
end

-- Initialize the Vungle plugin
local initParams = appID .. "," .. placementID1 .. "," .. placementID2
vungle.init( "vungle", initParams, adListener )

-- Sometime later, load an ad for a specific placement
vungle.load( placementID1 )