revmob.startSession()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, RevMob, startSession
See also revmob.init()
revmob.*

Overview

Starts a RevMob session. It's recommended that you call this on an "applicationResume" system event (see the example below).

Note

A RevMob session is started automatically when you successfully call revmob.init().

Syntax

revmob.startSession()

Example

local revmob = require( "plugin.revmob" )

local function adListener( event )

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

-- Initialize RevMob
revmob.init( adListener, { appId="YOUR_APP_ID" } )

-- System event listener function
local function onSystemEvent( event )

    if ( event.type == "applicationResume" ) then
        -- Start a new RevMob session
        revmob.startSession()
    end
end

-- Add the system event listener
Runtime:addEventListener( "system", onSystemEvent )