如何在corona sdk中集成全屏RevMob广告

时间:2013-09-14 07:24:02

标签: lua corona revmob revmobads

我想整合全屏RevMob广告,并且能够添加它,但是当我尝试点击广告打开它并同时关闭添加时,我有时会得到didRemoveListener nil值的错误。请发布提出任何建议如何解决这个问题..谢谢

local storyboard = require "storyboard"    
local RevMob = require("revmob")
display.setStatusBar(display.HiddenStatusBar)

local fullscreen
local revmobListener

local storyboard = require "storyboard"    
local REVMOB_IDS = { 
    ["Android"] = "",
    ["iPhone OS"] = ""
}

RevMob.startSession(REVMOB_IDS)
RevMob.setTestingMode(RevMob.TEST_WITH_ADS)

local function ShowAds()
    fullscreen.RevMob.createFullscreen()
    RevMob.showFullscreen(revmobListener, REVMOB_IDS)
end

1 个答案:

答案 0 :(得分:0)

您需要两个ID placement_ids revmob_id

revmob_id 是应用ID https://console.revmobmobileadnetwork.com/mobile_apps

placement_id 是revmob中创建的应用中的广告单元

尝试点击应用标签中的应用,然后向下滚动,直至广告单元

那里应该有默认,点击默认,然后您将被重定向到新页面,那里应该有一个ID。这是该广告的展示位置ID

您还可以根据需要添加展示位置,并使用所创建展示位置的展示位置ID。

local PLACEMENT_IDS = {[REVMOB_ID_ANDROID] = "Your app id here", [REVMOB_ID_IOS] = "Your app id here"}

local function revmobListener(event)
    print("Event: " .. event.type .. " - " .. event.ad)
    if event.type == "adReceived" then
    elseif event.type == "adNotReceived" then
    elseif event.type == "adClicked" then
        revMobBanner = RevMob.createBanner({listener = revmobListener }, PLACEMENT_IDS)
    end
end

local REVMOB_IDS = { ["Android"] = "Your placement id here", ["iPhone OS"] = "Your placement id here" }
RevMob.startSession(REVMOB_IDS)

revMobBanner = RevMob.createBanner({listener = revmobListener }, PLACEMENT_IDS)