Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Problem exporting Android APK with ads and Gaming services Plugin — Gideros Forum

Problem exporting Android APK with ads and Gaming services Plugin

FavflyFavfly Member
edited June 2017 in Plugins
I'm adding adverts to my game (...it's the last (it seems loooooooong) step before general release).
I've selected plugins '1. Ads' and '10. Gaming' and filled them in as best as I understand. Now when I export, I get the following...

image

The apk still exports fine and the game works (so long as I don't actually enable the code that uses adverts), these red lines of text clearly aren't optimal. Any ideas as to what I should do?

For clarity, below are the 'Ads' and 'Gaming' plugin selection windows. I've shown where I've made alterations.

image

image

KEY:
A = I ticked this box
B = Altered to 10.0.1 on advice found in forum @SinisterSoft
C = Application ID for my app (as found on Google Play Console), again pointed to from advice found on this forum.*
D = this is my app ID I got from Admob for my game.* Note the tilde separator, not forward slash.
E = this is my 'interstitial App unit ID' I got from Admob.*

* These numbers are not the real numbers used, but they are shown in the same format.

? Also, the reason I'm enabling Gaming Service Plugin is because I'm told it's needed when you use Admob. But should I be using Google Play Service Plugin as well or instead?

Comments

  • hgy29hgy29 Maintainer
    @Favfly,

    I can't see anything wrong so far, and you can disregard deprecated API as long as it compiles fine. What is the problem actually ?
  • FavflyFavfly Member
    So I can just ignore the red text? Cool.

    The problem is that, even though I think I've entered the correct information into the plugin boxes, whenever I try to enable ads (using the following code), the exported game crashes immediately after the splash screen.

    NB: I'm using Gideros 2017.4.1 on an iMac. And the first scene that sceneManager goes to is StartScene (below).

    (main.lua)
    --Adverts
    require "ads"
     
    --Initialize ads
    admob = Ads.new("admob")
    admob:enableTesting()
     
    adText = TextField.new(conf.fontBetLine, "text")
    	adText:setPosition(10, 570)
    	adText:setTextColor(0x000000)
    	stage:addChild(adText)
     
    admob:addEventListener(Event.AD_RECEIVED, function(e)
    	adText:setText("AD_RECEIVED")
    end)
    admob:addEventListener(Event.AD_FAILED, function(e)
    	adText:setText("AD_FAILED", e.error)
    end)
    admob:addEventListener(Event.AD_DISMISSED, function(e)
    	adText:setText("AD_DISMISSED")
    end)
    admob:addEventListener(Event.AD_DISPLAYED, function(e)
    	adText:setText("AD_DISPLAYED")
    end)
    (StartScene.lua)
    --Trigger Adverts
    admob:setKey(3456789012345678/8901234567)
    admob:loadAd("interstitial", ca-app-pub-3456789012345678/8901234567)
    admob:showAd("interstitial")
    NB: If the above code in StartScene is commented out, the game does not crash.

    I hope you can help me.
  • hgy29hgy29 Maintainer
    I think your lua code (StartScene.lua) is wrong: you must quote the string ids:
    admob:setKey("3456789012345678/8901234567")
    admob:loadAd("interstitial", "ca-app-pub-3456789012345678/8901234567")
    admob:showAd("interstitial")
    Also, I am not an expert about Admob, but shouldn't the key and id be different ?

    Likes: Favfly

    +1 -1 (+1 / -0 )Share on Facebook
  • FavflyFavfly Member
    I based my (StartScene.lua) code on this discussion:

    http://giderosmobile.com/forum/discussion/5187/admob-banners-disappear-after-interstitial-is-loaded/p1

    ...near the bottom of that page.
    admob:setKey("12345/6789")
    admob:loadAd("interstitial", "ca-app-pub-12345/6789")
    admob:showAd("interstitial")
    It seemed to work for @Tom2012

    Also, I'm not Admob expert. This is the first time I've attempted to use it.
  • hgy29hgy29 Maintainer
    Yes, but in the code you've quoted:
    admob:setKey(3456789012345678/8901234567)
    you set the key as an integer while gideros expects a string, which is probably the cause of your crash.

    Likes: Favfly

    +1 -1 (+1 / -0 )Share on Facebook
  • FavflyFavfly Member
    Doh! School-boy error. Thanks. :-bd

    It's not crashing anymore. And although I don't see any adverts on screen, my 'adtext' variable is telling me I'm receiving them.

    Is that what to expect when adverts have :enableTesting()?
    +1 -1 (+2 / -0 )Share on Facebook
  • piepie Member
    edited June 2017
    If I'm not wrong you should see admob test banners - which are like placeholder images (unless they changed something, I used it at least a year ago). :)

    Likes: Favfly

    +1 -1 (+1 / -0 )Share on Facebook
  • FavflyFavfly Member
    edited June 2017
    @pie It took a while, but I can finally see admob test interstitials. Yay! Unfortunately, when I click to dismiss one and go back to my game --almost immediately-- I'm being shown another one ...then another, and another, and another.
    I have this particular interstitial set at Admob to "show no more than 1 impression per user per 1 minute" (for test purposes). But I get a deluge of them.

    Any ideas what I might be doing wrong?
  • YanYan Member
    Never mind. Got my answer from here: :-D
    http://giderosmobile.com/forum/discussion/6962/any-documentation-about-admob-integration-#Item_21
    Yo, glad my topic helps ))). Did you solved a RED TEXT ? Have this too.

    Likes: Favfly

    vk.com/yan_alex
    +1 -1 (+1 / -0 )Share on Facebook
  • FavflyFavfly Member
    Apparently, red text can be ignored so long as the export builds successfully.
    NB: I still get red text, but the exported apk works just fine.
  • YanYan Member
    edited June 2017
    Apparently, red text can be ignored so long as the export builds successfully.
    NB: I still get red text, but the exported apk works just fine.
    Same to me. By the way, can you help me with update my Google Play service Plugin in Gideros build, have you kinda manual ?

    vk.com/yan_alex
  • FavflyFavfly Member
    @Yan I don't use the Google Play Service plugin (I use the gaming plugin), so I don't think I can help you. Sorry.
  • Yes, that's right, the google play services plugin is kinda depreciated, use gaming instead (like you did @Favfly ). :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.