admob.isLoaded()

Type Function
Return value Boolean
Revision Release 2022.3683
Keywords ads, advertising, AdMob, isLoaded
See also admob.show()
admob.*

Overview

Returns a boolean indicating whether an ad is loaded and ready for display.

Syntax

admob.isLoaded( adType )
adType (required)

String. One of the following values:

  • "interstitial"
  • "banner"
  • "rewardedVideo"
  • "rewardedInterstitial"

Example

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" } )

-- Sometime later, check if an interstitial ad is loaded
print( admob.isLoaded( "interstitial" ) )