vungle.load()

Type [Function][api.type.function]
Return value Boolean
Revision Release 2024.3703
Keywords ads, advertising, Vungle
See also vungle.init()
vungle.*

Overview

vungle.load() begins loading a placement video 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.v6" )

local appID
if ( system.getInfo("platform") == "android" ) then
    appID = "YOUR_ANDROID_APP_ID"
else
    appID = "YOUR_IOS_APP_ID"
end

-- Vungle listener function
local function adListener( event )

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

-- Initialize the Vungle plugin
vungle.init( appID, adListener )

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