startapp.isLoaded()

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

Overview

Returns a boolean value whether an ad is loaded and ready for show.

Syntax

startapp.isLoaded( adType )
adType (required)

String. The ad type to check. Valid values: "interstitial", "video", "rewardedVideo", "offerwall".

Example

local startapp = require( "plugin.startapp" )

local function adListener( event )
    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
        -- Load an StartApp ad
        startapp.load( "interstitial" )
    elseif ( event.phase == "loaded" ) then  -- The ad was successfully loaded
        print( event.type )
    elseif ( event.phase == "failed" ) then  -- The ad failed to load
        print( event.type )
        print( event.isError )
        print( event.response )
    end
end

-- Initialize the StartApp plugin
startapp.init( adListener, { appId="Your App ID" } )

-- Sometime later, check if the ad is loaded
print( startapp.isLoaded( "interstitial" ) )