vungle.init()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, Vungle
See also vungle.load()
vungle.show()
vungle.*

Overview

vungle.init() initializes the Vungle plugin. This call is required and must be executed before making other Vungle calls such as vungle.load() or vungle.show().

Syntax

vungle.init( appID [, adListener] )
appID (required)

String. The App ID for your app, gathered from the Vungle dashboard.

adListener (optional)

Listener. The function or table that will handle adsRequest lifecycle events from the Vungle plugin.

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 )