inMobi.init()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, InMobi, init
See also inMobi.load()
inMobi.show()
inMobi.*

Overview

inMobi.init() initializes the InMobi plugin.

Once initialized, you can load an ad using inMobi.load() and subsequently show it via inMobi.show().

Syntax

inMobi.init( adListener, params )
adListener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

Table. Table containing InMobi initialization values — see the next section for details.

Parameter Reference

The params table includes initialization properties for the InMobi plugin.

accountId (required)

String. Your InMobi account ID. You can find this ID in the InMobi developer portal, located under your account drop-down menu.

logLevel (optional)

String. The InMobi log level you wish to use. Valid options are "debug" or "error". The "debug" log level is useful for gathering specific device IDs from the Xcode Organizer or Android monitor which can be entered into the InMobi developer portal during testing. Default behavior is no logging.

Example

local inMobi = require( "plugin.inMobi" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
    end
end

-- Initialize the InMobi plugin
inMobi.init( adListener, { accountId="YOUR_ACCOUNT_ID", logLevel="debug" } )