Unity Android Banner Ads? (AdMob)

Im wondering whats the best way to integrate ads into Unity Android, as Unity outputs apk files directly, there seems to be no way to use admobs native java sdk.

Admob doesn’t seem to have custom API for me to call…
so I guess I’m left with reversing their sdk and replicating it in Unity/C#?

Before I start doing this, has anyone solved this or have any other recommendations?

Just an update, it seems admob integration might be easy

i used apktool to decode the apk file and then it looks like you might be able to just change the layout like step 5 in this guide…

http://developer.admob.com/wiki/Android

I haven’t tried it yet but will report back when i do so

there is a .NET javaVM which you could just include to call out to it I guess.

There is, and this has been discussed on the Google groups Android beta list (if you are member of that). Either way, here is quick recap:

http://beta.unity3d.com/erik/AndroidAdIntegration.unitypackage

includes an example of how to access Admob and Quattro Wireless (but ignore the QW as they no longer support Android). It uses the java plugin feature to override the normal UnityPlayerActivity (Unity’s Java code for Android) to add a banner on top of the GL screen. Please read the code as this is no fire-and-forget solution for ads to magically appear in your apps. Also, it has been reported that there are mac/windows incompatibilities with the build script, so might need some changes if you’re on mac.

Does anyone have any information on compiling this on Mac? When I try to rebuild with my changes it can’t find the Admob and Quattro .jar/classes no matter how I include their paths in the .sh file (which I’m dragging and dropping onto the Terminal window). Any clues?

Just in case anyone was wondering, I got it to work by changing the classpath from a quoted semi-colon delimited list to a non-quoted colon delimited list of classes to include.

Sir
I want to know few thing I just import the package and wana know next what i do in this …i m confuse anyone help me to make out of this…

did anyone help me to understant how to do that…

Hi I also tried that but I couldn’t

I downloaded AdMobTest.unitypackage on
GooBall is out for the Mac !!! - Industries - News & General Discussion - Unity Discussions?

I opened Plugins/Android project on Eclipse

I added 2 jar files to lib directory of eclipse project

(1)Applications/Unity right-clicked and Show Package Content-> /Contents/PlaybackEngines/AndroidPlayer/bin/classes.jar

(2)GoogleAdMobAdsSdk-X.X.X.jar

AdMobTestActivity.java

package org.example.AdMobTest;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

import com.unity3d.player.*;

import com.google.ads.AdView;
import com.google.ads.AdSize;
import com.google.ads.AdRequest;

public class AdMobTestActivity extends UnityPlayerActivity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setupAds();
	}

	private void setupAds() {
		// And this is the same, but done programmatically

		LinearLayout layout = new LinearLayout(this);
		layout.setOrientation(LinearLayout.VERTICAL);
		addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));

		AdView adView = new AdView(this, AdSize.BANNER, "ADMOB_ID");
		layout.addView(adView, new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.WRAP_CONTENT));
		

		adView.loadAd(new AdRequest());
	}
}

I changed ADMOB_ID to mine

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.companyname.appname"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />

    <application android:icon="@drawable/app_icon" android:label="@string/app_name">
        <activity android:name=".AdMobTestActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
		<activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation"/>
  </application>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

</manifest>

I changed “com.companyname.appname” to mine

And I compiled by running Eclipse

I move bin folder of Eclipse and tried below command

jar cvf com.companyname.appname.jar \com

jar file created on /Assets/Plugins/Android/bin

And I build on Unity

But, I can’t…

“inneractive Ads for Android” was released on Asset Store

it is too hard

I resolved without using plugin

May you share your exp. on this ?

could someone maybe post his working code or a plugin or something i can work with?
i will continue searching and post my results here…

This is two old.
Some new plugin available such as https://github.com/unity-plugins/Unity-Admob