vungle.isLoaded()

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

Overview

Returns a boolean indicating whether an ad is loaded and ready for display.

Syntax

vungle.isLoaded( placementId )
placementId (required)

String. The placement ID to check if loaded

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, check if an ad (placement ID) is ready for display
print( vungle.isLoaded( "placementID1" ) )