Quick Links: Gideros Home | Download Gideros | Developer Guide
App crash when hiding ad the second time (Admob)
  • HolonistHolonist +1 -1
    Member
    Hi,

    I would like to give players the ability to show/hide ads for a little bonus.

    In my app, currently an ad is loaded and shown on start.

    When you click the button, the ad hides. As intended
    When you click the button again, the ad (or a new one, not sure) displays. As intended
    When you click the button once again, my app crashes. (should simply hide again...)

    simplified code in my button click listener:


    --ad initialization
    ad = Ads.new("admob")
    -- ...

    ad:showAd("banner", unitID)
    showAds = true

    --this goes inside my button:onclick()
    if showAds == true then
    showAds = false

    if ad then
    ad:hideAd("banner")
    end
    else
    showAds = true

    if ad then
    ad:showAd("banner")
    end
    end






  • HolonistHolonist +1 -1 (+1 / -0 )
    Member
    I'm an idiot.
    The crash was not because of ads.
    It was because of a sprite that I remove too, but then forgot to add again on the next button click.

    Likes: antix

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters