Type library Keywords ads, advertising, AdBuddiz Platforms iOS, Android
The AdBuddiz plugin allows for easy integration of AdBuddiz premium full-screen ads in your application.
To use the AdBuddiz service, please sign up for an account.
local adbuddiz = require( "plugin.adbuddiz" )
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 =
{
plugins =
{
["plugin.adbuddiz"] =
{
publisherId = "com.adbuddiz"
},
},
}
-- This simple example displays AdBuddiz ads (interstitial + rewarded video) on request
display.setStatusBar( display.HiddenStatusBar )
local adbuddiz = require( "plugin.adbuddiz" )
local widget = require( "widget" )
adbuddiz.setLogLevel( "Info" ) -- Log level
adbuddiz.setAndroidPublisherKey( "TEST_PUBLISHER_KEY" ) -- Replace with your Android app publisher key
adbuddiz.setIOSPublisherKey( "TEST_PUBLISHER_KEY" ) -- Replace with your iOS app publisher key
adbuddiz.setTestModeActive() -- Delete before submitting to store
adbuddiz.cacheAds() -- Start caching ads
local function interstitial_showAdClick()
adbuddiz.showAd()
end
local showAdButton = widget.newButton
{
left = 20,
top = 20,
width = 120,
height = 40,
label = "Show Ad",
onRelease = interstitial_showAdClick
}
local function rewardedVideo_fetchClick()
adbuddiz.RewardedVideo_fetch()
end
local fetchButton = widget.newButton
{
left = 20,
top = 80,
width = 120,
height = 40,
label = "Fetch",
onRelease = rewardedVideo_fetchClick
}
local function rewardedVideo_ShowClick()
adbuddiz.RewardedVideo_show()
end
local showButton = widget.newButton
{
left = 160,
top = 80,
width = 120,
height = 40,
label = "Show",
onRelease = rewardedVideo_ShowClick
}
-- Events (interstitial)
local function listener( event )
if event.value == "didCacheAd" then
print( "didCacheAd" )
end
if event.value == "didShowAd" then
print( "didShowAd" )
end
if event.value == "didClick" then
print( "didClick" )
end
if event.value == "didHideAd" then
print( "didHideAd" )
end
if event.value == "didFailToShowAd" then
print( "didFailToShowAd - " .. event.detail )
end
end
Runtime:addEventListener( "AdBuddizEvent", listener )
-- Events (rewarded video)
local function listenerRewardedVideo( event )
if event.value == "didFetch" then
print( "didFetch" )
end
if event.value == "didComplete" then
print( "didComplete" )
-- Reward user here
end
if event.value == "didNotComplete" then
print( "didNotComplete" )
end
if event.value == "didFail" then
print( "didFail - " .. event.detail )
end
end
Runtime:addEventListener( "AdBuddizRewardedVideoEvent", listenerRewardedVideo )
More support is available from the AdBuddiz team: