Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Any documentation about AdMob integration ? — Gideros Forum

Any documentation about AdMob integration ?

YanYan Member
edited June 2017 in Plugins
Theres no actual documentation about integration. For example whem I try to run test in Player, theres error:
require 'ads'
admob = Ads.new('admob')
admob:setKey('ca-app-pub-3940256099942544')
admob:enableTesting()
admob:showAd("auto")
main.lua:6: module 'ads' not found:
	no field package.preload['ads']
	no file '.\ads.lua'
	no file 'C:\Program Files (x86)\Gideros12\lua\ads.lua'
	no file 'C:\Program Files (x86)\Gideros12\lua\ads\init.lua'
	no file 'C:\Program Files (x86)\Gideros12\ads.lua'
	no file 'C:\Program Files (x86)\Gideros12\ads\init.lua'
	no file '.\ads.dll'
	no file 'C:\Program Files (x86)\Gideros12\ads.dll'
	no file 'C:\Program Files (x86)\Gideros12\loadall.dll'
So I only can integrate Ads through, compilation via Android Studio ?
vk.com/yan_alex

Comments

  • hgy29hgy29 Maintainer
    Yes, player don't come with Ads plugin integrated mainly because most Ads provider need compile time settings like App ID
  • YanYan Member
    Yes, player don't come with Ads plugin integrated mainly because most Ads provider need compile time settings like App ID
    So my only way is to try Integrate via Android Studio, and export directly to APK with ADS is not able ? Am I right ?
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Accepted Answer
    You can export a custom player to APK right from Gideros Studio and select the plugins you want to embed in it, no need to open Android Studio! Just export your project the regular way with plugins selected and configured, just choose 'Player' export mode instead of 'Full' or 'Asset only' exports mode.
  • YanYan Member
    edited June 2017
    Well, so If I want Player (EXE) or Device (APK) build with embeded ADS, I just need to configure plugins and export ?

    Because only one Doc Ive found says I need Android Studio
    Program Files (x86)/Gideros12/All Plugins/ads/install.html
    Installation
    Android
     
    Copy libs folder into your exported project
     
    Copy src folder into your exported project
     
    Add System.loadLibrary("ads"); to your main activity
     
    Add "com.giderosmobile.android.plugins.ads.Ads" as external class in your main activity
     
    You must install each ad framework you want to use based on their instalation instructions (usually by adding .jar file to project and modifying AndroidManifest file)
     
    For Android Studio projects, you should usually add in your module gradle file the path to the previously added jars (something like: compile files('libs/XXX.jar' in the dependencies block)
     
    To add new ad framework to Android, create a class with Ads prefix and only first Caps letter of ad frame work, for example, to add AdMob support, create AdsAdmob class which implements AdsInterface, then wrap all autogenerated methods to AdMob functionality.
     
    To add something to the rendering View, use Ads.addAd or Ads.removeAd static methods
    And this manual says Im also need change default Activity:

    http://docs.giderosmobile.com/interface/ads
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Accepted Answer
    Yes... in theory :) Because I don't think AdMob will work on desktop player, I was referring to device player (APK)
  • YanYan Member
    Well, so I pooped up again ... it ain helps
    0.PNG
    822 x 541 - 49K
    1.PNG
    976 x 986 - 82K
    2.PNG
    953 x 978 - 76K
    3.PNG
    954 x 983 - 72K
    5.PNG
    667 x 722 - 56K
    txt
    txt
    export_details.txt
    22K
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Accepted Answer
    I see you used two different versions of google service libs (7.8.0) and (9.2.0). You should the same everywhere!
  • YanYan Member
    edited June 2017
    I see you used two different versions of google service libs (7.8.0) and (9.2.0). You should the same everywhere!
    Well, its the latest build ive downloaded, and I didnt changed anything, I just need to configure libraries or need to update them manually, If second, so how ?

    UPD. I changed version to 7.8.0, and it did compiled for device. Still have no Idea how to ipdate plugin, because I thank I will have troubles on old version

    UPD. Well this code does nothing ... or I missed something ?

    durning compilation only this warning appears:
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    require 'ads'
    admob = Ads.new('admob')
    admob:setKey('ca-app-pub-3940256099942544')
    admob:enableTesting()
    admob:showAd("auto", "ca-app-pub-8277494013979890/1311313966")
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Accepted Answer
    Looking twice at your settings, your app id doesn't look good either: it should be numerical. See http://giderosmobile.com/forum/discussion/6959/problem-exporting-android-apk-with-ads-and-gaming-services-plugin for a similar discussion
  • YanYan Member
    Latest UPDATE, it works only when I export only player and run project from Studio, but it aint work from full apk.
    vk.com/yan_alex
  • YanYan Member
    edited June 2017
    Looking twice at your settings, your app id doesn't look good either: it should be numerical. See http://giderosmobile.com/forum/discussion/6959/problem-exporting-android-apk-with-ads-and-gaming-services-plugin for a similar discussion
    Well, my app still not in Play Market, so it doesnt actually have an Id. Thanks 4 link, google never shows me this thread !

    I did reach the target, but only when I export only player and run project from GStudio, but it aint work from full apk. Any clues ?
    Just an interstitial aint works for test mode, everything fine ! Great thanks !
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    it won't work at all without an app id
  • hgy29hgy29 Maintainer
    What happens in full apk ? does it crash ? if so it would be handy to have a logcat log to help you, it can be a variety of things
  • YanYan Member
    edited June 2017
    What happens in full apk ? does it crash ? if so it would be handy to have a logcat log to help you, it can be a variety of things
    My mistake, just an interstitial aint works for test mode, everything fine ! Great thanks !
    it won't work at all without an app id
    And I swear it works with those settings Ive posted before, I just changed GooglePLaye services version to 7.8.0
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Oh, so maybe it works in test mode without an app id after all :P
  • YanYan Member
    edited June 2017
    Oh, so maybe it works in test mode without an app id after all :P
    Yep, I think this is because of test mode. By the way, is there any docs, how to update gideros Google Play Service plugin to have an actual version ?
    vk.com/yan_alex
  • YanYan Member
    edited June 2017
    I have one starnge behavior:
    require 'ads'
    admob = Ads.new('admob')
    admob:setKey('ca-app-pub-8277494013979890')
    admob:enableTesting()
     
     
    -- Event.AD_RECEIVED fires only after uncoment this line !
    --admob:showAd("auto", "ca-app-pub-8277494013979890/1311313966") 
     
    admob:addEventListener(Event.AD_RECEIVED, function(e)
    	-- This function fires only If I request AD manually !
            print("admob AD_RECEIVED", e.error)
    	--admob:showAd("interstitial", "ca-app-pub-8277494013979890/1311313966")
    end)
     
    admob:addEventListener(Event.AD_ERROR, function(e)
    	print("ads AD_ERROR", e.error)
    end)


    UPD needed to admob:loadAd() before you get event !
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    Accepted Answer
    You should trigger ad loading by using admob:loadAd(xxx). showAd() implicitly call loadAd if no ads are loaded yet
  • YanYan Member
    edited June 2017
    You should trigger ad loading by using admob:loadAd(xxx). showAd() implicitly call loadAd if no ads are loaded yet

    Right, also found this in google http://docs.giderosmobile.com/interface/ads, I think this information should be accesible from this reference with more informative Label than "Labs", it was not obvious that in this section might be info about Ads plugin =)
    vk.com/yan_alex
  • YanYan Member
    edited June 2017
    You should trigger ad loading by using admob:loadAd(xxx). showAd() implicitly call loadAd if no ads are loaded yet

    Well, theres one more issue:
    require 'ads'
    admob = Ads.new('admob')
    admob:setKey('ca-app-pub-8277494013979890')
    admob:enableTesting()
    admob:loadAd("interstitial", "ca-app-pub-8277494013979890/1311313966")
    admob:addEventListener(Event.AD_RECEIVED, function(e)
    	p("RECIEVED")
    	admob:showAd("interstitial", "ca-app-pub-8277494013979890/1311313966")
    end)
    Works great, BUT, after I close INTERSTITIAL, Event.AD_RECEIVED - fired again, so I see AD in a loop, not very userfriendly ...


    As hgy29 says showAd() calls loadAd() therefore I get loop - my false again.

    Likes: Favfly

    vk.com/yan_alex
    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    I personally would avoid admob (unless you have 2 google accounts). I know of people who have had their google accounts (inc apps) suspended because a google AI bot suspected them of click fraud.
    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
  • YanYan Member
    I personally would avoid admob (unless you have 2 google accounts). I know of people who have had their google accounts (inc apps) suspended because a google AI bot suspected them of click fraud.
    Any advise on other AD ? And one more question: does Gideros ADS plugin can provide AdMob reward video ?
    vk.com/yan_alex
  • SinisterSoftSinisterSoft Maintainer
    Applovin 9/10, chartboost 6/10
    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.