Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Ads Interface - Page 16 — Gideros Forum

Ads Interface

1101112131416»

Comments

  • yaxxaryaxxar Member
    edited July 2015
    Hello dev friends, I'm new, and I have a lot of questions, I have a project and I put all the libraries and the admob plugins but when I need to show the ad it does not appear in the center of the screen in each game over, I ' m working in eclipse and I'm using this code in my game:
    require 'admob'
     
    		admob.loadAd("87u89chsd9dsfdsuf", "banner")
     
    		admob.setAlignment('center', 'top')
     
    		Timer.delayedCall(15000, function()
    		admob.removeAd()
    		end)
    Logcat is not showing any error from the app, what can be wrong? I ´m using the Google play services project.
  • ar2rsawseenar2rsawseen Maintainer
    if you are using AdsInterface, then it should be more like:
    require "ads"
    local admob = Ads.new("admob")
  • simwhisimwhi Member
    @yaxxar I think you also need to call admob:showAd( adType ). adType can be set to the type of ad that you've pre-loaded. You also need to handle events coming back to your app from the ads interface. Use this reference to help you:

    http://docs.giderosmobile.com/interface/ads

    @ar2rsawseen Does loadAd() work for the admob plugin?
  • ar2rsawseenar2rsawseen Maintainer
    @simwhi yes true, it will load an ad, but won't display it. loadad is only for preloading
  • yaxxaryaxxar Member
    @ar2rsawseen @simwhi hello again, and thanks for the help, I added the code admob:showad("banner") but now is not found in the plugin I think because I look the plugin code but I didn t find the function showAd, thanks.
  • simwhisimwhi Member
    @yaxxar Make sure that the function calls are correctly capitalised. I also noticed that you are calling admob.removeAd(). I don't think that function exists. I haven't seen it documented anywhere. I use admob:hideAd("banner").
  • yaxxaryaxxar Member
    @simwhi hello, in the plugin code there is the function removeAd() and it wont crash or show any error on my app, I bet is something with showAd but I can t work right now in my game cause I'm on my another work :\">
  • simwhisimwhi Member
    @yaxxar If you are just showing banners then admob:showAd("banner") should work.

    Here's a snippet of code from my project:

    require('ads')

    self.admob = Ads.new("admob")

    self.admob:addEventListener(Event.AD_FAILED, self.onAdFailed, self)
    self.admob:addEventListener(Event.AD_ERROR, self.onAdError, self )

    self.admob:setKey( key )
    self.admob:showAd( self.adType )
    self.admob:setAlignment("center", "top")







  • yaxxaryaxxar Member
    Now I'm thinking about all my troubles are cause I only use the AdMob plugin without ads interface
  • simwhisimwhi Member
    @yaxxar This is the Ads interface:

    require('ads') -- plugin

    self.admob = Ads.new("admob") -- create an Ads object for admob
  • yaxxaryaxxar Member
    @simwhi
    @ar2rsawseen
    Thanks a lot for your help!, now I can see the ad, but my new issue is when I try to close the ad in eclipse show this error:

    07-28 00:34:55.792: E/AndroidRuntime(24117): com.giderosmobile.android.player.LuaException: C:/Users/yaxxar/Documents/NNGAct/NNG/assets/assets/Classes/GameDemo.lua.jet:377: attempt to call method 'removeAd' (a nil value)

    I tried to close like this
    ads.removeAd()
    --or
    ads:reoveAd()
    I don t know what is wrong, thanks for everything!
  • simwhisimwhi Member
    @yaxxar removeAd() does not exist. You'll need to use hideAd("banner")
  • yaxxaryaxxar Member
    @simwhi thanks a lot, I m a total newbie in Gideros and game programming :\"> but with your help and of course with @ar2rsawseen, things turn very easy, thanks a lot I gonna try in the night

    Likes: tuanleanh

    +1 -1 (+1 / -0 )Share on Facebook
  • tuanleanhtuanleanh Member
    edited November 2015
    At last, I can build admob - iOS, I needed so long time, thanks @ar2rsawseen :)
  •  
Sign In or Register to comment.