Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
AdMob — Gideros Forum

AdMob

JackoJacko Member
edited October 2015 in Suggestions & requests
Hi,
Can someone tell me step by step how to add AdMob?
thanks in advance:)

Comments

  • Hi Jacko

    This caused me a few headaches but checkout my little guide here

    http://giderosmobile.com/forum/discussion/5922/solved-problem-running-admob-on-android/p1

    Let me know if you hit any problems
  • Hi @Tom2012
    I get error at point 14)
        <application android:icon="<a href="https://forum.gideros.rocks/profile/drawable%2Ficon%26quot" rel="nofollow">@drawable/icon&quot</a>; android:label="<a href="https://forum.gideros.rocks/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>; android:theme="<a href="https://forum.gideros.rocks/profile/android" rel="nofollow">@android</a>:style/Theme.NoTitleBar.Fullscreen"
        <!-- google play -->
        <meta-data android:name="com.google.android.gms.version" android:value="<a href="https://forum.gideros.rocks/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version&quot</a>; />
        <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
            >
  • If I pass your points how add admob? :)
  • Have you added google play services into your project OK?
  • Tom2012Tom2012 Guru
    edited October 2015
    Oh and you have to really make sure that those lines are not broken. They need to be one line. Double click the AndroidManifest.xml file in Android studio to check there's no line break / carriage return in there as this caused errors for me many times.

    EDIT - Should look like:
    <!-- google play -->
    <meta-data android:name="com.google.android.gms.version" android:value="<a href="https://forum.gideros.rocks/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version&quot</a>; />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    And not...
    <!-- google play -->
    <meta-data android:name="com.google.android.gms.version" 
    android:value="<a href="https://forum.gideros.rocks/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version&quot</a>; />
    <activity android:name="com.google.android.gms.ads.AdActivity" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
  • As for getting Admob into your Gideros project...

    First add this to your main.lua file
    -- Ads plugin
     
    require "ads"
     
    admob = Ads.new("admob")
    --admob:enableTesting() -- loads test ads when enabled
     
    admob:addEventListener(Event.AD_RECEIVED, function(e) 
    	if(adType=="interstitial") then
    		adReceived = true
    	end
    	print("got ad",e.type)
    end)
     
    admob:addEventListener(Event.AD_FAILED, function(e) 
    	print("ad failed",e.error)
    	adReceived = nil
    end)
    When you want to load an ad, use:
    admob:setKey("1111111/2222222")
    	admob:loadAd("banner", "ca-app-pub-1111111/2222222")
    	admob:showAd("banner")
    Let me know how you get on!
  • Hello Sir,
    You were right I did not have added Google Play
  • Cool! Hope the rest of the install goes OK. :)>-
  • AdMob can not be tested in Gideros?
  • It can, but only on the same platform you implement it in.

    So if you add plugin to Android, you can test it only on Android :)
  • What if get this error?

    no field package.preload['ads']
    no file './ads.lua'
    no file '/usr/local/share/lua/5.1/ads.lua'
    no file '/usr/local/share/lua/5.1/ads/init.lua'
    no file '/usr/local/lib/lua/5.1/ads.lua'
    no file '/usr/local/lib/lua/5.1/ads/init.lua'
    no file './ads.so'
    no file '/usr/local/lib/lua/5.1/ads.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
  • then you incorrectly added the plugin to project.

    either libads.so file is missing, or you did not place System.load("ads") in main activity
Sign In or Register to comment.