Admob Unity Package that work with Unity 3.2, 3.3, 3.4 3.5

A NEW INDEPENDENT PLUGIN WITH NEW FEATURES…

Hi Guys, After putting a lots of effort on Admob integration with Unity, i have something for you all.

Please Read full tutorial before start. might you miss some important points. Good Luck

Now its not just basic, i advanced it to some more control over Admob.

NEW FEATURES;

1. Make Adv visible or invisible anytime.
2. Completely Disable Adv programatically.
3. Perform 4 Animations on AdView container so that they appear or disappear smoothly.

Here is the basic AdMob package implementation that works with almost every Unity Version greater den(i tested on 3.2, 3.3, 3,4 3.5)
The older method, i found in Unity Forums is no more working hav some issue with ANT Android SDK version eclipse.

What you need to implement??:
JUST Unity with android SDK

Direction of Using Admob Plugin.
Class AdvertisementHandler.cs contains functions that you can call from anywhere in your Unity Project bcoz its a static class.

Now, lets take a trip of features in this class to control Admob plugin.
1. Instantiate: Call this function only once in life of unity project run. This function will instantiate all variables in plugin. This function have some arguments:

    1. Your Admob PublisherIdD.
    1. Advertisement Size: You can choose your advertisement Size or Let the plugin handle(Recommended). Please choose anyone from AdvSize enum
    1. advOrient: Gives you control over Advertisement Orientation. Please choose anyone from AdvOrientation enum
    1. Position 1 Position 2: Its a combination of two direction where you want Advertisement to display. Please choose anyone from Position enum
    1. isTesting: Its a boolean variable. Set this to true, if your are testing your unity game. This will affect your eCPM
    1. animIn: Animation for Advertisement container, when application receive Advertisement. Please choose anyone from AnimationInType enum. Use NO_ANIMATION for No Animation.
    1. animOut: Animation for Advertisement container, when application receive Advertisement old container need to go. Please choose anyone from AnimationOutType enum. Use NO_ANIMATION for No Animation.
  • . levelOfDebug: Define Level of debud log in device LogCat here. None: you wont get any log from admob plugin, LOW: you will get minimal required logs, HIGH: You will get flood of logs in your device logcat.

2. EnableAds(): Call this to enable Ads.

3. DisableAds(): Call this to disable Ads. Use EnableAds() to regain Advertisements.

4. HideAds(): This will Hide Advertisement temporarily. Use ShowAds() to make Adv visible again.

See “AdvertisementManager.cs” for more detail of how to control Admob Plugin.

Attach “AdvertisementManager.cs” on a game object to make it run.

NOTE: 'AdvertisementHandler.cs" is a static class, so use above functions like “AdvertisementHandler.EnableAds()” without creating any object of class.

I Have Attached Two 7z file:

  1. AdmobUnityPackage.7z: This contains only file for your project.
  2. AdmobProject.7z: Contains a complete test project.

IMPORTANT:
If you are planning to use with another plugin, then in AndroidManifest.xml change value key in below line to True. By default its set to False
.

If nothing happens on Adv click, then use above changes in AndroidManifest.xml

If you get any issue plz share with me with full log from plugin. :smile::smile:

UPDATED TO LATEST ADMOB SDK 6.0.1

HAPPY GAMING…

Thankx for using this plugin…


864113–36492–$AdmobUnityPackage.7z (541 KB)
864113–36493–$AdmobProject.zip (803 KB)

Amazing post. And glad someone finally did it. I was going to make one but then I took a game to the knee. So busy=X lol anyway thanks mate

In your service… @joelsantos

WOW!,Thanks a lot for this tutorial!

I have completed all the steps correctly without getting errors, but I can’t receive ads.
Is there any posibility to adapt the AdMobTestActivity.java to the new AdMob SDK 4.3.1?
I think that that is my problem.

Yes ffff1111,
I wrote this tutorial for ADmob package that is embeded in unityPackage… i haven’t tried with new AdmobSDK…
Please use AdmobPackage in SDK to get ur game workng…

Thanks for sharing.

There was a guy on the forum who tried with the new admob sdk in the android skd extras folder, but what I don’t like of these “plug-in” approach is the fact that you extend the UnityPlayerClass, this works, but is wrong.

Especially when you link against common JARs or the Android SDK itself.

I’m trying to get a different version of the plug-in, with no java-compile, and no UnityPlayer extension.

I hope I’ll be able to do it.

As far as I know Prime31 did it, but 40$ are too much to don’t give a try first !
If I succeed I will sell this plug-in for 20$.

Litobyte Softworks,
Unity Engine gives us power to access Native code from Unity itself using AndroidJNI. Can you tell me, Why is this Wrong?

You can refer these pages Here Here.

Wat i wrote is based on unity tutorials its Free, Easy to use Customize.

And this is my first try with plugins.

I am terribly sorry MicroEyes, I didn’t intend to attack or flame you in any way !
I was just expressing my technical opinion on the matter.

What do you think about an AdMob plugin, which compiles against the latest google.ad from the latest SDK (is retro compatible until minimum API=4!) which would be a simple .jar file and a .cs class to put in your plugin folder, then, without to do anything with 2 lines of code from anywhere you would set up the ad banner on screen ?

You did a good job with JNI, but I don’t use JNI call, but JavaClass.
And I don’t extend the UnityPlayer so, no subclassing, is lightweight, and to the point.

I will post some update soon.

The plug-in is there, it plays great with OpenFeintFacade together with our “force feedback” plug-in.

Two files, 2 lines of code to get the ad on screen.

Time to pack it!

i followed the tuto , and apk is force closing in device and emulator .
can u explain me about this line
Line 108: adView.setKeywords(Add keywords as string); in the java file .

would you upload a complete project files including a empty scene .

kiranmaya,
i’ll upload my test project. Can you send me ur android log after crash…

i deleted everything at present,will try once again.

I have attached my “AdMob” test project.

project is working well,
but if I change id and add the library
advertising in the scene do not have,
changing back your id - ad works again
that I could forget?

roxxy,
According to me, the problem is with your Admob account. please check it properly, whether you add the ID highlighted in image…

new Admob id not work with old sdk=(
AdMob SDK Update
All new Android, iPad, iPhone, and Windows Phone 7 apps require an AdMob SDK that was released on or after March 15, 2011.

If you are using a version of the AdMob SDK that was released before March 15, 2011, then your new app will not receive any ad impressions.

Roger That…I’ll update my tutorial asap… :smile:

my old game id ,com.marketingstreams.arunner ,which was was registered in admob around march 2011 is working and geting ads ,
but newly created id (a week back ),com.acegames.raceCar is not receiving ads .

Of course Kiranmaya, according to new google admob guidelines, after october 2011 you HAVE to use the newest adMobGoogle.jar version 4.0.1 or newer.

We have just baked a no-java-compile no-headscracth plugin for the new adMob, if interested drop me a line or a PM,

Tom

Thankx kiranmaya for your precious Feedback.

Guyz, I have updated my Admob Tutorial to Latest Admob SDK 4.3.1 and uploaded new unitypackage a working Test Project with screen output…