revmob.load()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, RevMob, load
See also revmob.show()
revmob.isLoaded()
revmob.*

Overview

Preloads a RevMob ad. You can also call revmob.isLoaded() to verify that the ad has been loaded and revmob.show() to show it.

Syntax

revmob.load( adUnitType, placementId )
adUnitType (required)

String. The type of ad to display. Valid values are "banner", "interstitial", "video", or "rewardedVideo".

placementId (required)

String. The placement ID of the ad you want to load.

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" } )