startapp.init()

Type Function
Return value none
Revision Release 2022.3683
Keywords ads, advertising, StartApp, init
See also startapp.load()
startapp.*

Overview

startapp.init() initializes the StartApp plugin.

This call is required and must be executed before making other StartApp calls.

Syntax

startapp.init( listener, params )
listener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

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

Parameter Reference

The params table includes parameters for the StartApp initialization.

appID (required)

String. The app ID for your app, gathered from the StartApp portal.

enableReturnAds (optional)

Boolean. Set this value to false to disable return ads. Default is true.

Example

local startapp = require( "plugin.startapp" )

-- StartApp listener function
local function adListener( event )
    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
    end
end

-- Initialize the StartApp plugin
startapp.init( adListener, { appId="Your App ID", enableReturnAds = true } )