Type Function Return value none Revision Release 2022.3683 Keywords ads, advertising, InMobi, load See also inMobi.show() inMobi.isLoaded() inMobi.*
Preloads an InMobi ad. You can also call inMobi.isLoaded() to verify that the ad has been loaded and inMobi.show() to show it.
inMobi.load( adUnitType, placementID [, params] )
String. The type of ad according to the InMobi placement ID. Supported values are "banner"
or "interstitial"
.
String. The placement ID for the ad, retrieved from the InMobi developer portal. This is a numeric string and is listed in the InMobi developer portal under the label Placement ID.
Table. Table containing customization parameters for banner ads — see the next section for details.
The params
table can include properties for customizing a banner ad. This does not apply to interstitial ads.
Number. The width of the banner ad. InMobi returns a 320
.
Number. The height of the banner ad. InMobi returns a 50
.
Boolean. Boolean value that determines if a banner ad should refreshInterval
below)false
.
Number. The refresh interval, in seconds, for which banner ads should autoRefresh
is set to true
. Default is 60
.
local inMobi = require( "plugin.inMobi" ) -- Pre-declare a placement ID local placementID = "PLACEMENT_ID" local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Load a banner ad inMobi.load( "banner", placementID ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) print( event.placementId ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.placementId ) print( event.isError ) print( event.response ) end end -- Initialize the InMobi plugin inMobi.init( adListener, { accountId="YOUR_ACCOUNT_ID" } )