revmob.isLoaded()

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

Overview

Checks to see if a RevMob ad is already loaded. Returns true if an ad is loaded/ready, otherwise returns false.

Syntax

revmob.isLoaded( placementId )
placementId (required)

String. The placement ID of the ad that you want to check is loaded.

Example

local revmob = require( "plugin.revmob" )

local placementID = "PLACEMENT_ID"

local function adListener( event )

    if ( event.phase == "sessionStarted" ) then  -- Successful initialization
        -- Load a RevMob ad
        revmob.load( "banner", placementID )

    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 RevMob
revmob.init( adListener, { appId="YOUR_APP_ID" } )

-- Sometime later, check if the ad is loaded
local isAdLoaded = revmob.isLoaded( placementID )
print( isAdLoaded )