admob.*

Type Library
Revision Release 2020.3619
Keywords ads, advertising, AdMob
Platforms Android, iOS

Overview

The AdMob plugin allows developers to monetize users through AdMob static interstitial ads, video interstitial ads, rewarded video ads, and banner ads.

Important

Check out new hasUserConsent admob.load() parameter to enable GDPR data collection restrictions.

Registration

Before you can use this plugin, you must register with AdMob.

Syntax

local admob = require( "plugin.admob" )

Functions

Events

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    android =
    {
        applicationChildElements =
        {
            [[
                <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
                    android:value="[YOUR_ADMOB_APP_ID]"/>  -- replace with your app id. See: https://goo.gl/fQ2neu
            ]],
        },
    },
    iphone =
    {
        plist = {
            GADApplicationIdentifier = "[YOUR_ADMOB_APP_ID]",
            SKAdNetworkItems = {
                {
                    SKAdNetworkIdentifier = "cstr6suwn9.skadnetwork",
                },
            },
        },
    },
    plugins =
    {
        ["plugin.admob"] =
        {
            publisherId = "com.coronalabs"
        },
        -- See: http://docs.coronalabs.com/plugin/att
    },
}
Important

Add App Tracking Transparency plugin to your project as well.

Important

If you are building for Android, you should remove any legacy inclusion of the ["plugin.google.play.services"] plugin from your build.settings.

Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"
  • "android.permission.ACCESS_NETWORK_STATE"

Sample project