appnext.getAutoPlay()

Type Function
Return value Boolean
Revision 2017.3060
Keywords ads, advertising, Appnext, getAutoPlay
See also appnext.setAutoPlay()
appnext.*

Overview

Relevant for interstitial ads only. Indicates whether a video will auto-play when showing an interstitial ad.

Syntax

appnext.getAutoPlay( adKey )
adKey (required)

String. The ad key returned for a previously created ad.

Example

local appnext = require( "plugin.appnext" )

local function adListener( event )
    print( "Received " .. event.event .. " for " .. event.adKey .. " with message: " .. event.message )
end

-- Initialize the Appnext plugin
appnext.init( adListener )

-- Create your ads
local interstitialPlacementID

local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
    interstitialPlacementID = "YOUR_IOS_INTERSTITIAL_PLACEMENT_ID"
elseif ( platform == "Android" ) then
    interstitialPlacementID = "YOUR_ANDROID_INTERSTITIAL_PLACEMENT_ID"
end

local interstitialAdKey = appnext.createAd( "interstitial", interstitialPlacementID )

appnext.setAutoPlay( interstitialAdKey, false )

if ( appnext.getAutoPlay( interstitialAdKey ) ) then
    print( "AutoPlay is true" )
else
    print( "AutoPlay is false" )
end