Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Free Admob plugin, simple prefab.

Discussion in 'Android' started by CuddlyBunnie, Jan 25, 2013.

  1. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    And here we go, instead of screwing around with the old one I stumbled on a new plugin that can solve all of the problems, Download link here

    Just as easy as the previous one, simply drop in the prefab and put in your own Publisher Id. It now has all options exposed so changing the positioning, type and size of the banner is much easier. A quick note if you change the banners location during run time ensure you call .Reconfigure (); afterwards, .Hide(); and .Show(); don't need this though. If you don't need to do any of this during run time just change the options in the prefab to whatever you want..

    All credit here as before.
     
  2. Redsun-pro

    Redsun-pro

    Joined:
    Nov 29, 2013
    Posts:
    6
    wow ! after many days of searching, teste and errors ! juste like a magic i got this topic and everything works great :D
    i have some questions if someone can help me :

    1 - how can i add admob Intertitial ads with this plugin ? (simple way)
    2 - i'm trying to use Chartboost but not working so far, someone knows if there is a free simple plugin for Charboost ?

    really thank CuddlyBunnie you're great ;)
     
  3. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    1. Sadly this doesn't support Intertitial ads, sorry.
    2. Chartboost is pretty easy to get going, take a look at https://help.chartboost.com/documentation/unity
     
  4. Twisted Triangle

    Twisted Triangle

    Joined:
    May 21, 2014
    Posts:
    1
    Hi CuddlyBunnie,
    Could you help me out please? I have imported the plugin, dragged the prefab onto the scene, switched "is testing" off, also mockup and developer is added to the prefab but turned off. Publisher ID is addedm but when I deploy the app onto an actual android device(phone) no ads show up. In unity if I turn mockup on, I see the dummy ads. I use unity 4.3. Any idea what I do wrong? Thanks in advance.
     
  5. Omer.Hussain

    Omer.Hussain

    Joined:
    Dec 16, 2013
    Posts:
    5
    i drag the prefab in my scene and when i play it doesn't show banner nether any error .. i just imported the package through my asset then drag the prefab in my scene ... now i haven't give my own id because i want to just test is it work or not ... or is it i have to put my new id then play .....? i tried to play the test scene which is already available in the package and it show the same .. nothing .. which step i could be missing ?
     
  6. fanling3

    fanling3

    Joined:
    May 5, 2012
    Posts:
    12
    I have the same issue. Can see ads with "Is Testing" on, but see nothing if it's off.
     
  7. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    Well that's weird, I just tried it by dragging the prefab in an it worked straight away. You guys are using the new version of admobs console right? This doesn't work with the legacy console. Also does everything work when you leave all the default variables set? If it does it has to be some problem with the setup in the ad mob console.

    Feel free to add me on skype at majorsolard@hotmail.com if you liek and we can try and sort it out.
     
  8. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    I have a feeling you might be using the old plugin as you have mention a test scene which i haven't included in this package(there should only be a prefab). To see the ads it also has to be deployed onto an Android device.
     
  9. Sposito

    Sposito

    Joined:
    May 4, 2014
    Posts:
    16
    Anyone here get it working on iOS? the first build i tried on iOS didn't worked(build failures on XCode), after some search I found that I should import some Libraries and it is building without errors. just dragged the prefab onto my game, set up my adBanner ID(in the inspector is asking for my Publisher ID, but is the banner actually, right?) now stuff run well but Ads don't show UP am I missing any step? (I am using unity 4.5 by the way).
     
  10. schetty

    schetty

    Joined:
    Jul 23, 2012
    Posts:
    424
    Thank you...
     
  11. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    I'm afraid unlike the previous one this plugin doesn't support iOS, The reason your not getting errors is that the initialize is marked as #if UNITY_ANDROID. You can remove that and have a play but i have no iOS devices to test on at the moment.
     
  12. Sposito

    Sposito

    Joined:
    May 4, 2014
    Posts:
    16
    CuddlyBunnie, I dont want to be annoying, is great all u have done 4 us. But if you have interest I can give u vnc acess to my devices.
     
  13. ScorpionDeity

    ScorpionDeity

    Joined:
    Sep 19, 2012
    Posts:
    38
    This plugin is amazingly easy to use - kudos on a great help to us developers!

    My question involves testing. I can switch between test ads and production ads just fine by toggling the IsTesting on and off, but what I need to do is have that flag get turned on based on the device ID. Is there a way to get the ID and switch that? The SystemInfo.deviceUniqueID is a different ID and I can't seem to find a way to make this happen.

    What I'm looking for is a way to have this automatically turn on testing if people in my own household are running my app to avoid any problems with Google/Admob.

    Edit: Here is what I came up with to make this work for my needs for TEST devices:

    1. Get "Android Device ID" from Google Play, use it to get the Android ID
    2. Add the Android ID to the Test Device IDs array in the Admob prefab in the scene (Do this for each Android device that should load test ads and not real ads
    3. IsTesting unchecked (for production build!)
    4. Make sure Guess Self ID is checked
    Now, I added the following code at the beginning of Start(), in the AdMobPlugin.cs file:

    Code (csharp):
    1.  
    2. AndroidJavaClass up = newAndroidJavaClass("com.unity3d.player.UnityPlayer");
    3. AndroidJavaObject currentActivity = up.GetStatic<AndroidJavaObject>("currentActivity");
    4. AndroidJavaObject contentResolver = currentActivity.Call<AndroidJavaObject>("getContentResolver");
    5. AndroidJavaClass secure = newAndroidJavaClass("android.provider.Settings$Secure");
    6. string androidID = secure.CallStatic<string>("getString", contentResolver, "android_id");
    7.  
    8. for (int i = 0; i < this.testDeviceIds.Length; i++)
    9.    {
    10.          if (this.testDeviceIds[i].Trim() == androidID)
    11.                    this.isTesting = true;
    12.    }
    13.  
    14.  
    Hopefully this might help someone looking to do the same as myself to keep their accounts safe :)
     
    Last edited: Jul 3, 2014
  14. jvt619

    jvt619

    Joined:
    Jul 4, 2013
    Posts:
    53
    can't seem to make this work :( it wont show even if I put the publisher id and device id and even checking the isTesting
     
  15. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    Nice work, sorry i dont check this very often but looks like you figured it out okay:)
     
  16. CuddlyBunnie

    CuddlyBunnie

    Joined:
    Jan 25, 2013
    Posts:
    26
    Does it work fine with the default publisher id?
     
  17. SrvZ

    SrvZ

    Joined:
    Aug 22, 2014
    Posts:
    1
    Hi CuddlyBunnie I appreciate your plugin making admob integration much easier as I am completely noob to unity game development . But I have a query that admob is going use play services from 31st August 2014, does your plugin be functional after that date as admob sdk will be obsolete. Also if I add play services.jar into the plugins folder will it work? It will very helpful if you can please let me know how can I add play service to your prefab. Once again thanks for this awesome work !!!
     
  18. Alvintchui

    Alvintchui

    Joined:
    Jul 17, 2014
    Posts:
    1
    Anyone knows does the plugin work with IOS as well?
    Tired to build an xcode project but no ads showed up....am I missing any setup?

    Thanks.
     
  19. surendar

    surendar

    Joined:
    Jul 23, 2014
    Posts:
    2
    i added like cuddlybunnie said.. i dragged a admob prefab and set publisher id.. bt no ads are visibile .... it doesnt works .. pls tell me
     
  20. surendar

    surendar

    Joined:
    Jul 23, 2014
    Posts:
    2
    same pblm for me... could u pls help me?
     
  21. Zahidylin_Marat

    Zahidylin_Marat

    Joined:
    Jul 28, 2012
    Posts:
    114
  22. Punit_UnityUser

    Punit_UnityUser

    Joined:
    Jul 24, 2014
    Posts:
    1
    hii CuddlyBunnie , how r u buddy, i gotta say ..u did some amazing stuff.. i hav been looking for 2 days on how to set up admob ads ..

    its working for me ..showing ads
    just drag n drop prefab right ?

    but when i look at the script this line
    AndroidJavaClass pluginClass = new AndroidJavaClass("com.guillermonkey.unity.admob.AdMobPlugin");

    (guillermoney)

    do i hav to replace that with my package name ?

    otherwise everything is fine
    thank u so much

    jus let me know about that
     
  23. lamxung55

    lamxung55

    Joined:
    Aug 1, 2014
    Posts:
    10
    I drag Admob Prefab into my scene, modify unit ads ID and banner position. Nothing is displayed on my scene( on android devices and also on Unity Editor)
    What can I check now?
    Thank you
     
  24. HappyLDE

    HappyLDE

    Joined:
    Apr 16, 2014
    Posts:
    56
    Why do i get the banner across all scenes? I want to have different banners on different scenes, an help? :D Thank alot by the way great plugin!!!
     
  25. lalli143

    lalli143

    Joined:
    Jul 30, 2012
    Posts:
    33
    Hi,
    I am trying this plugin .Ads are coming But I cannot see any change in admob performance reports.Am I doing anything wrong.Please suggest me.

    Regards,
    Lalitha
     
    Last edited: Oct 30, 2014
  26. HappyLDE

    HappyLDE

    Joined:
    Apr 16, 2014
    Posts:
    56
    Up, same banner across all scenes even if i have one different prefab in each scene with different settings, please help :)
     
  27. HappyLDE

    HappyLDE

    Joined:
    Apr 16, 2014
    Posts:
    56
    Did you unchecked is test in the prefab settings? Also set the right ad id.
     
  28. Vect0rZ

    Vect0rZ

    Joined:
    Nov 5, 2014
    Posts:
    2
    Awesome, thanks.

    Can I ask about that Publisher ID. Should I only put this? Isn't there a unique code for every new Ad Unit I make in AdMob? Or I just put the Publisher ID there?
    And should it start with ca-app-..?
     
    Last edited: Nov 6, 2014
  29. tiesna

    tiesna

    Joined:
    Nov 3, 2014
    Posts:
    2

    i was try it but no ads display :(
     
  30. Simon-L

    Simon-L

    Joined:
    Dec 14, 2014
    Posts:
    1
    U ARE A FKN GENIUS CUDDLYBUNNIE!!! ;)

    Seriously i tried the whole week every evening and searched and tested and deleted and so on. then finally on sunday i found this site with your godlike work.

    dropped the prefab in my scene, AND THAT WAS ALL, IT RUNS!!!!

    Thank you!!!

    u are the KING!

    bowing down,
    Simon L
     
  31. rebelholic

    rebelholic

    Joined:
    Jan 25, 2014
    Posts:
    6
    I've got error message like this when trying to build into APK:
    Code (csharp):
    1.  
    2. Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    3. C:\Program Files\Java\jdk1.8.0_20\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="E:/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "E:/project/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
    So can anyone help me to solve this problem?

    If you don't have any solution for this problem maybe this plugin not compatible again with latest Google Play Games SDK
     
    Last edited: Dec 18, 2014
  32. RuMad

    RuMad

    Joined:
    Aug 4, 2012
    Posts:
    4
    Guys. How can I detect touch on AdMob? :S
     
  33. ninofrenn

    ninofrenn

    Joined:
    Jan 10, 2015
    Posts:
    3
    Hello,
    Can I simple attach the admobplugin script to main camera rather than drag and drop admob prefab?

    Thankyou
     
  34. PedroNeves

    PedroNeves

    Joined:
    Feb 23, 2014
    Posts:
    10
    hello guys,
    Everything is working great with the prefab, but how do i change background color? and how do i set the ads to be the same i created in admob dashboard?
     
  35. funny_hair_mouse

    funny_hair_mouse

    Joined:
    Jan 17, 2015
    Posts:
    1
    Brilliant. You couldn't have mad this easier. :) Thanks a lot.
     
  36. Karate_Master

    Karate_Master

    Joined:
    Feb 24, 2015
    Posts:
    2
    hi guys
    I use your plugin and it kinda work but show me only error "You must have AdActivity declared in AndroidManifest.xml with configChanges.":( I am a total noob in game dev, programming and everything else so... Guys i need your help!
    Here is my AndroidManifest.xml
    Code (CSharp):
    1.  
    2. <?xmlversion="1.0"encoding="utf-8"?>
    3. <manifestxmlns:android="http://schemas.android.com/apk/res/android"android:installLocation="auto"package="com.example.admobtest"android:versionName="1.0"android:versionCode="1">
    4. <supports-screensandroid:smallScreens="true"android:normalScreens="true"android:largeScreens="true"android:xlargeScreens="true"android:anyDensity="true"/>
    5. <!--GoogleMobileAdsPermissions-->
    6. <uses-permissionandroid:name="android.permission.INTERNET"/>
    7. <uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
    8. <applicationandroid:icon="@drawable/app_icon"android:label="@string/app_name"android:debuggable="false">
    9. <!--meta-datatagforGooglePlayservices-->
    10. <meta-dataandroid:name="com.google.android.gms.version"android:value="@integer/google_play_services_version"/>
    11. <activityandroid:name="com.unity3d.player.UnityPlayerProxyActivity"android:label="@string/app_name"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    12. <meta-dataandroid:name="unityplayer.ForwardNativeEventsToDalvik"android:value="true"/>
    13. <intent-filter>
    14. <actionandroid:name="android.intent.action.MAIN"/>
    15. <categoryandroid:name="android.intent.category.LAUNCHER"/>
    16. </intent-filter>
    17. </activity>
    18. <activityandroid:name="com.unity3d.player.UnityPlayerActivity"android:label="@string/app_name"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    19. </activity>
    20. <activityandroid:name="com.unity3d.player.UnityPlayerNativeActivity"android:label="@string/app_name"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    21. <meta-dataandroid:name="unityplayer.ForwardNativeEventsToDalvik"android:value="true"/>
    22. <meta-dataandroid:name="android.app.lib_name"android:value="unity"/>
    23. </activity>
    24. <activityandroid:name="com.unity3d.player.VideoPlayer"android:label="@string/app_name"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    25. </activity>
    26. <!--GoogleMobileAdsActivity-->
    27. <!-- <activityandroid:name="com.google.android.gms.ads.AdActivity"
    28. android:label="@string/app_name"
    29. android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">-->
    30. <!--IncludetheAdActivityconfigChangesandtheme. -->
    31. <activityandroid:name="com.google.android.gms.ads.AdActivity"
    32. android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
    33. </application>
    34. <uses-featureandroid:glEsVersion="0x00020000"/>
    35. <uses-sdkandroid:minSdkVersion="9"android:targetSdkVersion="21"/>
    36. </manifest>
    37.  
     
  37. Nikolausan

    Nikolausan

    Joined:
    Mar 2, 2015
    Posts:
    3
    Tried it and it's working.thanks
     
  38. Karate_Master

    Karate_Master

    Joined:
    Feb 24, 2015
    Posts:
    2
    I don't now what exactly happens but now it works... Grate plugin THX!)
     
  39. FahmiHasan

    FahmiHasan

    Joined:
    Jan 9, 2013
    Posts:
    4
    Your package is working fine, but whenever i change publisher id with mine, it doesn't work. Anyway i found that publisher id format is different. In package is typed: ca-app-pub-xxxxx/xxxxx and mine ID is pub-xxxxxxxx. Do I have to write my pub ID in same format as yours or i only type my ID? thanks for the respons

    Edit:
    My bad, it works now. Only have to set up banners on AdMob and type the Add unit ID generated by AdMob.

    Great Packages!!!
     
    Last edited: Mar 18, 2015
  40. CluelessMuffin

    CluelessMuffin

    Joined:
    Feb 14, 2015
    Posts:
    63
    I am getting error while building Unable to convert "Unable to convert classes into dex format"


    I am using unity 5, is there a new version for this?



    CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    C:\Program Files\Java\jdk1.8.0_45\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="G:/Users/Samer/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "G:/Program Files/Unity2/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -



    Note that I had no problem in building before adding this plugin.
     
  41. achillesdotexe

    achillesdotexe

    Joined:
    Jan 28, 2013
    Posts:
    6
    I am also facing the same issue "Unable to convert classes into dex format". Log as follows,

    Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/prakash/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/Unity4.6.2p2.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar" -

    stderr[

    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdSize;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
    at com.android.dx.command.dexer.Main.processClass(Main.java:732)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at SDKMain.main(SDKMain.java:130)
    1 error; aborting
    ]
    stdout[
    processing archive bin/classes.jar...
    processing com/unity3d/player/a$1.class...
    processing com/unity3d/player/a$2.class...
    processing com/unity3d/player/a$a.class...
    processing com/unity3d/player/a.class...
    processing com/unity3d/player/b.class...
    processing com/unity3d/player/c$1.class...
    processing com/unity3d/player/c$2.class...
    processing com/unity3d/player/c.class...
    processing com/unity3d/player/d.class...
    processing com/unity3d/player/e$1.class...
    processing com/unity3d/player/e$2.class...

    ---------goes on and on.....

    We are using unity4.6.2p2, google admob from this http://forum.unity3d.com/threads/free-admob-plugin-simple-prefab.167731/page-2", targeting for android.

    Thanks in advance!
     
  42. achillesdotexe

    achillesdotexe

    Joined:
    Jan 28, 2013
    Posts:
    6
    Hi, We have edited the jar file manually[JD-GUI]and removed duplicate references of google ads in google-play-services.jar, working fine now on android.

    Ads not showing up on iOS, the Admob.load() function is getting called and printing the debug log. Any one has any idea why?
     
  43. Frontpage2

    Frontpage2

    Joined:
    Oct 16, 2015
    Posts:
    1
    I am trying to use the plugin for the first time. The mockup script works fine, I can see the sample banner both in Unity itself and on my Android phone, when connected with Unity remote in test mode. But after I build the apk and install to the phone it is not there. Does it matter what x, y, and z coordinates the admob prefab has on the scene? Doe it matter if the app is build as horizontal, vertical, or auto rotate?
     
  44. mehdi14

    mehdi14

    Joined:
    Jul 18, 2015
    Posts:
    1
    worked in unity 5 ??
     
  45. Dino000

    Dino000

    Joined:
    Dec 15, 2013
    Posts:
    5
    @mehdi14 Yes it does.

    Does anyone know how to set tag for child directed treatment in this plugin?
     
  46. bigjobs

    bigjobs

    Joined:
    Feb 24, 2016
    Posts:
    14
  47. bigjobs

    bigjobs

    Joined:
    Feb 24, 2016
    Posts:
    14
    I am using https://github.com/unity-plugins/Unity-Admob
    and there is a option

    Admob.Instance().setTesting(true);
    Admob.Instance().setForChildren(true);
     
  48. Pongky

    Pongky

    Joined:
    Jun 28, 2016
    Posts:
    3
    nothing happen in my games ?? still no ad ??
     
  49. AmineMessa

    AmineMessa

    Joined:
    Jan 6, 2017
    Posts:
    6
    Any update ?
    Does it work for anyone ?

    Cause i cant get it to work for me :'(

    Help guys