Type Function Return value none Revision Release 2024.3703 Keywords ads, advertising, AdMob, init See also admob.show() admob.load() admob.*
admob.init()
initializes the AdMob plugin. This call is required and must be executed before making other AdMob calls such as admob.load().
admob.init( listener, params )
Listener. Listener function that will receive adsRequest events.
Table. Table containing AdMob initialization values — see the next section for details.
The params
table includes parameters for AdMob initialization.
String. The app ID for your app, gathered from the AdMob dashboard.
Make sure to use same AdMob app ID as in the build.settings section of the [plugin][plugin.admob].
Boolean. Set this value to true
to enable test ads. Default is false
.
Number. Set desired volume for video ads. Valid values are in the range 0.0
- 1.0
. 0.0
for muting ads completely. Default is 1.0
.
Video ads that are ineligible to be shown with muted audio are not returned for ad requests made when the app volume is reported as muted or set to a value of 0. This may restrict a subset of the broader video ads pool from serving.
You should always use test ads during development testMode = true
)
local admob = require( "plugin.admob" ) -- AdMob listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) end end -- Initialize the AdMob plugin admob.init( adListener, { appId="YOUR_ADMOB_APP_ID" } )