ADMOB, integrate both banner and interstitual issue

Hi,

I can get either banners or interstituals working only.

I have a game, a banner ad is called at the start no problem, I then hide it when the user clicks to play again on the game over screen.

I then call an interstitual ad for the screen before the game replays.

Now I can get either the banner or the interstitual working but not both/???

Can I only call init once? I dont think so.

ANy comments would be cool

Hi @bubblebobble,

Initialization is done just once, and then “show” is used to display either banner or interstitial. Is this how you’ve set it up? And, by the way, which device(s) are you testing on?

Brent

hi Brent,

yes it is set up as in the docs, problem occurs when trying to use 2 different ads.

Devices are, nexus 7, htc one x, samsung galaxy s3, htc sensation.

I have no issues displaying either type but both is a no no.

I know I should only init once but it inits the appID for a banner or an interstitial.

Example:

initialize admob

I have a banner ad setup with an  appID

I have an interstitial setup with an appID2

[lua]

  local provider = “admob”
  local appID = “appID”

  local appID2 = “appID2”
  ads.init( provider, appID, adListener )

  ads.init( provider, appID2, adListener )

  local adX = 0
  local adY = 0
  ads.show( “interstitial”, { x=adX, y=adY } )

  ads.show(“banner”, { x=adX, y=adY })

[/lua]

the hide it

ads.hide(“banner”) …unsure if this can be done but works ok

ads.show(“interstitial”)

ads.hide(“banner”)

etc etc

Seems I can only call one appID at a time when I init the session.

Hi @bubblebobble,

Initialization is done just once, and then “show” is used to display either banner or interstitial. Is this how you’ve set it up? And, by the way, which device(s) are you testing on?

Brent

hi Brent,

yes it is set up as in the docs, problem occurs when trying to use 2 different ads.

Devices are, nexus 7, htc one x, samsung galaxy s3, htc sensation.

I have no issues displaying either type but both is a no no.

I know I should only init once but it inits the appID for a banner or an interstitial.

Example:

initialize admob

I have a banner ad setup with an  appID

I have an interstitial setup with an appID2

[lua]

  local provider = “admob”
  local appID = “appID”

  local appID2 = “appID2”
  ads.init( provider, appID, adListener )

  ads.init( provider, appID2, adListener )

  local adX = 0
  local adY = 0
  ads.show( “interstitial”, { x=adX, y=adY } )

  ads.show(“banner”, { x=adX, y=adY })

[/lua]

the hide it

ads.hide(“banner”) …unsure if this can be done but works ok

ads.show(“interstitial”)

ads.hide(“banner”)

etc etc

Seems I can only call one appID at a time when I init the session.

Have you solved this? Because i have the same issue.

Is there a reason you need two AppID’s?  Can’t one deliver both banners and interstitials?  (remember I’ve never use adMob before…)

no. when you create an ad in admob you can choose whatever it’s a banner or an interstitial. i made both, and i have 2 app ids. do you know any workaround? i’d like to implement it as soon as possible, since my ecpm on chartboost is like 0.5$. 

i already trade initializing both at the beginnig, initializing interstitial right before showing it, making another require ads variable. the result is that it shows me only the first one i initialize.

EDIT: can i at least “deinitialize” it?

I never did find out how to do this or even if its possible.

I messed with it for a good time and gave up, ended up using Admob and revmob togethor, not perfect but at least I could have both banner and fullscreen.

As for de initializing it, I dont think so, I couldnt find anything in api that would do this.

well, then i’ll try the admob + playhaven combo

is there any fix coming at least? because i really need to implement them both. all other networks have very low ecpm, i got lik 20k impressions with 0.5$ ecpm daily, so its kinda a waste

I’m curious if you could flush the admob module and hit the init again.

This is a function I use to “unrequire” modules:

[lua]
— Removes references to a module.

@param m Name of the module you want removed.

local function unrequire( m )

  package.loaded[m] = nil

  _G[m] = nil

  return true

end

[/lua]

I have not tested this myself, but I’m guessing you’d do something like so…

SceneN

[lua]

local ads = require( “ads” )

–< Show AD and later on…

unrequire( “ads” )

[/lua]

You’d probably want to unrequire it in your exit scene.  If I have time to test it later I will, but see if that works.

Cheers.

nope, it doesn’t work. as you said, im unloading the module on exitscene. the app only displays that first type of ads i initialized. i can switch em, but no way of making them work together

I’ve just been playing around with the new corona release and started tinkering with ads and plugins. This is a simple solution I came up with for using multiple adNetworks at once. I guess it could be extended into something like the "GGLib"´s or adMediator. 

I even tried having my adData on a remote server and remotely change adNetworks and it worked fine.

-- main.lua local ads = require("ads") local adData = { adsActivated = true, scenes = { menuScene = "admob", gameScene = "iads", settingsScene = "inneractive" }, networks = { ["admob"] = "123456789", ["inneractive"] = "123456789", ["iads"] = "com.company.appname" } } function adListener(event) local msg = event.response if event.isError then print("Ad error : "..msg) end end local function initAds() for k, v in pairs(adData.networks) do ads.init(k, v, adListener) end end function showBanner(params) local banner = nil local provider = params.provider local xPos, yPos = params.x, params.y if provider == "admob" then ads:setCurrentProvider(provider) banner = ads:show("banner", { x = xPos, y = yPos }) elseif provider == "inneractive" then ads:setCurrentProvider(provider) banner = ads:show("banner", { x = xPos, y = yPos }) &nbsp;&nbsp;&nbsp;&nbsp; elseif provider == "iads" then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ads:setCurrentProvider(provider) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; banner = ads:show("banner", { x = xPos, y = yPos }) end return banner end if adData.adsActivated == true then initAds() end

---------------------------------------------- -- someScene.lua -- Then you, if using storyboard.. local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local ads = require("ads") --[[.. whatever code... --]] function scene:enterScene(event) local group = self.view showBanner(adData.scenes.menuScene) end function scene:exitScene( event )&nbsp; &nbsp; local group = self.view ads.hide() end scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene )

tried pretty much all the suggestions in this thread, nothing working yet

I started this thread a while back, I actually think its an Admob issue rather than Corona specific.

Perhaps Admob only allows the device to register one ID to the app while its running.

I am sure it logs the device ID and associates it with one ID while the app is active.

However couldnt you just kill the socket and re init admob?

I dont know, thats why I gave up and reverted to 2 separate ad networks for both.

I would think it best to look at native Java and see if it can be done there, if it can then we have something to work with if not then we dont.

Just my thoughts.

it can’t be admob issue. doing this in eclipse, everything works fine. also, why would they make different ids for different ad types if there dont support them? this is coronas issue, the ads library to be precise

Brent, is Corona built to support only 1 type of ad per app session?

Corona SDK itself doesn’t enforce rules on what ad types can be shown.  All of the providers take parameters as to what can be shown and they have their own inventory to pull from.  Their code draws the ad and manages it.  We really are just a pass through to them.

What seems to be the problem with AdMob is that you have to have different AppID’s for the different Ad Types and Our system is really setup to only enable one AppID per vendor.  You only need one for all the other ad providers like iAds, Inneractive, inMobi, etc.  Now Inneractive and such use multiple AppID’s but its on a device by device basic, not on an ad type by ad type.  That is the AppID for an Apple device is different than for an Android device, so you can detect what platform you are on and send the right ID.

Would you be willing to file a bug report on this with a small sample app that demo’s the issues?

Have you solved this? Because i have the same issue.