ads

Hey guys

How do i display applovin ads when i click a button ??

I want to display rewarded ads and i got my sdk key from my applovin account…

local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) -- Load an AppLovin ad statusText.text = "STATUS: Ad is loading" statusText.x = display.actualContentWidth \* 0.14 applovin.load(true) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) applovin.show(true) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.isError ) print( event.response ) statusText.text = "STATUS: Try after some time" statusText.x = display.actualContentWidth \* 0.14 end end local function onTouch(event) adListener() end button:addEventListener("touch", onTouch) applovin.init( adListener, { sdkKey="sdk key", verboseLogging=true } )

Should this be the case ??

if wrong, then suggest me how do i do this ?

your onTouch needs to be
if event,phase == ended then
applovin.init( adListener, { sdkKey=“YOUR_SDK_KEY” } )
end

Thanks
Will give it a try

your onTouch needs to be
if event,phase == ended then
applovin.init( adListener, { sdkKey=“YOUR_SDK_KEY” } )
end

Thanks
Will give it a try