Mobclix plugin that works with Unity 3.2

And just to complement Open Feint and Ad Mob plugins for Unity Android, here’s the basic implementation of Mobclix plugin.

Please try it out and share your experience.

We provide it for free and we’d be really grateful for any contribution that makes sense.

Regards,
Unity Android team

502219–17774–$MobclixTest.unitypackage (229 KB)

Thank you thank you thank you :smile:

Downloading now… :wink:

Thanks much for the pluggin.
I have it working in my app displaying the 300x250 test ad, but cant seem to get it to display the 300x50 test ads.
I have them enabled in test mode in mobclix for the app.
Is there something else I have to do to display the 320x50?
Thanks for your help.

I tried to run the MobclixTest script with the editor set to android, but I get a message saying:

JNI: Unable to find method id for ‘getAd’
UnityEngine.AndroidJavaObject:Call(String, Object[ ])

Am I correct in assuming that you have to run it on an actual phone to get ads?

EDIT: turns out I was correct

Thanks a lot for this as we are most likely going to use MobClix.

killsage, here at Unity we just wanted to make the bootup easier, so we don’t support/maintain these plugins we made.
The sources are provided, so it’s the community who should chime in and adapt these for custom needs.

I had the same problem, but solved it by doing this:

1.) Open up “Plugins/Android/src/MobclixTestActivity.java”, and change the following 2 lines:

public static MobclixIABRectangleMAdView adView;

...

adView = new MobclixIABRectangleMAdView(this);

to this:

public static MobclixMMABannerXLAdView adView;

...

adView = new MobclixMMABannerXLAdView(this);

The “new LayoutParams(300, 250)” code doesn’t seem to affect it, but you can change that to “new LayoutParams(320, 50)” too.

2.) This is using a Mac, might be different on Windows, but using Terminal, go to the “Plugins/Android/” folder, and run:

ant build-jar

This re-builds the compiled .class and .jar files.

Note: You have to update the file “local.properties” to point to where you installed the Android SDK, or ant will fail.

3.) Now build the Android app again and try it on your device.

I haven’t found out how to position the ad though (especially when running landscape mode), or how to make it rotate when you rotate the phone.

Thanks for the info TMK, really useful

Regards,
Curious

TMK.
Thanks so much! That was exactly it. Works like a charm.

Great to hear that! Now we just have to figure out how to move the ad around (and how to rotate it when you rotate the phone) :slight_smile:

It took me a while to figure out the changes for windows. Maybe no one else has tried or everyone is smarter than me.

Windows users I suggest the following steps on top of TMK’s steps:

  1. Create a clean unity project called CleanMobclix and install the above package in there as well as in your game, and run it once to make sure you see the 320x250 ad you should see by default. (Make sure you’re connected to the internet or you won’t see anything).

  2. In your CleanMobclix project - Open up “Plugins/Android/build.properties” and change external.libs.absolute.dir to point to something like this (wherever you installed Unity to):

external.libs.absolute.dir=/Program Files (x86)/Unity/Editor/Data/PlaybackEngines/androidplayer/bin
  1. Again in CleanMobclix project - Open up “Plugins/Android/local.properties” and change sdk.dir to point to something like this (wherever you installed your Android sdk)
sdk.dir=/android-sdk-windows

and then follow TMK’s steps here:

  1. Finally copy the MobclixActivity.jar from your CleanMobclix project to your actual game and you should see the smaller ads.

I recommend the extra steps just in case anything goes wrong… as long as you keep a backup of the original MobclixActivity.jar that came with the package you can get back to a non-broken state.

…And this is all assuming you’ve installed the JDK and ANT and added them to your PATH.

It gives me 12 error while executing build-jar command…Can anyone help me on this?

Please see below log for reference.

Have you edited the file “local.properties” to point to where you installed the Android SDK? I don’t remember exactly what kind of error message I got when I hadn’t done that, but it was something similar to what you are getting…

Now its working nd I am able to see ads from Mobclix, but how can I set the ads to landscape left orientation?

Thanks JoshOClock - but step 3 of your instructions should read Plugins/Android/local.properties. Appreciate the info!

I’m getting this error when I try to rebuild the package using the instructions for getting the 320x50 ads.

I’m following the Windows instructions.

BUILD FAILED
F:\SoundMaker\Assets\Plugins\Android\build.xml:46: taskdef class com.android.ant
.SetupTask cannot be found
using the classloader AntClassLoader[ ]

I’m pretty sure I’ve got everything pointed to the right place, but I can’t get it to find that class.

Got a question about this. How do we get the application id? And any other id’s we need?
As i understand it you seem to have to upload the app first and get some sort of id from google, then
add that id to mobclix as an app, do you get the id after that so you can add it to your app?

I’m confused :slight_smile:

Ugh… when you run the build off of the F: drive, I guess you need to specify that the sdk is on the c: drive, huh?

Feeling a bit of an idiot now.

Just register on Mobclix.com and then ‘Add an Application’ fill it out and you’ll see your ID in the list. It doesn’t have anything to do with Google ID or anything. It’s a value your app sends to mobclix for revenue tracking. And can be used for iOS or Android.

READ THIS IF YOU’RE USING THIS PACKAGE!!!
READ THIS IF YOU’RE USING THIS PACKAGE!!!

Make sure you download the latest SDK and drop the mobclix.jar it comes with over the one that comes with the the unitypackage at the top of this thread.

The one in the unitypackage requests ‘root’ as mobclix was using it to do some testing. People won’t DL your game if you have that… and likely give you ‘1 star’ to warn others as it appears suspicous.