Type Function Return value none Revision Release 2022.3683 Keywords ads, advertising, InMobi, show See also inMobi.hide() inMobi.load() inMobi.isLoaded() inMobi.*
Shows an InMobi ad which was previously loaded via inMobi.load().
inMobi.show( placementID [, params] )
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 positioning parameters for banner ads — see the next section for details.
The params
table can include properties for positioning a banner ad. This does not apply to interstitial ads.
String. Vertical alignment of the banner. Valid options are "top"
, "center"
, or "bottom"
. Default is "top"
.
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 == "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" } ) -- Sometime later, check if the ad is loaded if ( inMobi.isLoaded( placementID ) ) then -- Show the ad inMobi.show( placementID, { yAlign="bottom" } ) end