Just looking at the OpenFeint SDK and going through the documentation it isn’t readily apparent if it’s possible to put the two together. Has anybody had any experience in the matter?
I would also like to know about this.
Yes, I’ve also been searching for some way to integrate Openfeint for iPhone and Android in Unity, but I haven’t been successful in finding something helpful yet.
If someone finds out anything helpful about this, please post!
Anyone?
I can report that I’m making good progress, but it’s very convoluted and I don’t have the time to put together a proper demo scene to really help everybody else (and it sounds like Unity 3.1 should make this process much simpler). I can point you in the direction I took - but it’s not for the feint (ha) of heart.
I started with the AdMob example project to put together a proper UnityPlayerActivity class (and the associated AndroidManifest, which needed to be modified slightly for OpenFeint). In the UnityPlayerActivity subclass, I basically just initialize OpenFeint with the settings for our game. Upon building the apk, you must then decompose the apk using apktool, add the proper openfeint resources (specifically the res folder and the assets folder), then repackage the apk (remember to sign it again - the demo cert works until release of course). That will make sure OpenFeint is hanging around doing it’s thing and has the resources it needs. (BTW, the unpack and repack sounds like something Unity 3.1 is going to help fix, based on comments I’ve seen from the admins).
In order to actually use OpenFeint though, you’ll need to put together another Android plugin, which I based off the java example plugin (the one with the JNI NativeBridge stuff). So far I’ve been able to create a Unity callable function to pull up the dashboard and one to submit a high score (no notification just yet).
It’s been 3 and a half days since I started working on this, and the first 2 were mostly throwaway after hitting various things that were either dead ends or looked like dead ends. But I think if you start in the right place, you can get to where I am in about a day.
BuzzJive, Unity 3.1 will be much better in Android plugins support. I can add you to the beta where the preview version of 3.1 is available. Just email me to oleg@unity3d.com if you’d like to posess the new Unity 3.1 beta.
Because this topic has come up a few times (both here on the forums, and on the beta list) I’ve created a sample facade object for OpenFeint. It’s not a fire-and-forget solution: you will need to alter the contents of this package to fit your needs (at the very least provide accurate login information).
If you change the C# scripts you only need to Build&Run from the editor (as usual).
If you change the Java code you need to rebuild the OpenFeintFacade.jar - the scripts provided uses ANT for this.
If you change the native code (jni.cpp) you need to rebuild the native library (libjni.so) - the build scripts for that uses the standard NDK make.
Thanks so much for your work on this. Like I noted in the beta group, I got this working in 30 minutes, and most of that time was spent setting things up at openfeint.
For anyone implementing this: Just open the .unitypackage while in your project that you wish to use openfeint with. It will open a dialog with a bunch of files, import them all.
Then just follow the few steps in the readme.txt that you just imported (if you have not downloaded openfeint/android sdks, you will need to do so).
Now if you include the openfeinttest scene in your build settings and build and run on an android device, you will get a screen with a few buttons that allow you to login to openfeint, post a static score, etc.
I tested logging out of openfeint and running this, it will prompt you to log in!
All of these commands are in the openfeinttest.cs script and are quite readable, you can simply implement these calls however you wish in your game (for example, initializing openfeint once the game starts, rather than on a button press).
+10 internets to erique. I know a lot of people were looking for this and simply didn’t have the knowledge to accomplish it.
erique,
I don’t suppose you could put together a more comprehensive tutorial for how to integrate the openfeint system and the leaderboards into an Android game. ie. what api’s are available etc etc and how to access elements returned from openfeint?
Many thanks for the package by the way - its certainly a step in the right direction
@mmuller, you can see the APIs by looking at the facade source code, it only contains a method to init OF, to submit a score and to submit an achievement at the moment. The problem is I can’t get it to work on an Android phone…
@erique, is there a support page/forum-post for this unity package? I am following the simple instructions in the readme but my app crashes on launch.
Any help on why am I getting this message: DllNotFoundException: jni?
And also this part? I think they are linked:
No help on this? Was really interested on using open feint in my game, since you can upload data and I can no longer use stack.dimeRocker
Opening the facade.unitypackage gives me
DllNotFoundException: jni
OpenFeintFacade.isUserLoggedIn () (at Assets/Plugins/OpenFeintFacade.cs:46)
OpenFeintTest.OnGUI () (at Assets/OpenFeintTest.cs:17)
What is wrong here? Do I have to add the jni (Dll) somewhere?
thanks,
pep
Hey guys, I’m trying to get this to work, I have the latest OF Android SDK and have copied the necessary file into their respective folders, and I’ve compiled the project successfully but when I run the application form my device (hTC Desire z) it doesn’t come up! It quits right after the load screen with no error(s).
Any help would be highly appreciated.
Thanks
That’s exactly what happened to me as well.
That’s lame! There’s got to be a way around this, I’m quiet sure! May be 3.2 will handle this, right? Anyone from UT? Can you confirm this please?
My app is in iTunes right now and I can’t wait to see it on the Android market as well
Help us please!
Thank you
OK, I’m trying to find a solution with your help guys, so here I go!
First off, here is a quite from the Readme file of the unity package provided here:
I’ve copied the assets and res to my Unity project but there’s no folder named ‘libs’! (I’m using OF 1.7 SDK - Android)
And there’s a ‘src’ folder instead, I believe they are java codes, so my guess, we should probably compile them, right? But how?
Anyone?
Any help would be appreciated guys,
Thanks
In my experience, OF 1.7 and Unity 3.1 are not compatible. They both try to make use of default XML layouts and conflict with each other. The only OF I can get to run properly is 1.0.1 - which is a pretty early version that they don’t even let you download anymore. I was able to get some sort of minor debug info out of OF 1.7 through the ddms tool, but it definitely wasn’t helpful. I eventually tracked down some crash when accessing the xml files and tried to put some logging statements in the OF source itself. I spent about a day and a half on it before just settling back to 1.0.1.
I should have documented my process, but I didn’t. The gist of it is that yes, you need to build the OpenFeint src into an OpenFeint.jar that you can drop in to your plugins folder (I had eclipse issues and eventually got it to compile through ant - and then I made it a jar). You need a subclass of UnityPlayerActivity that initializes OpenFeint with your settings. You need a modified AndroidManifest.xml in your Plugins/Android folder that loads your UnityPlayerActivity class and has all the other necessary OpenFeint activity settings.
It’s not a straightforward process at all.
Wow, I think we need help from both UT an OF guys! But I won’t stop digging
Thanks for the info
Ten hours straight today with 3.2 and I have gotten the most recent version of OpenFeint Android working with Unity! I’m very excited.
I’m too tired now to do a write-up or anything, but I will say that I used the .unityPackage above and customized a lot of things, produced my own .jar, etc.
If anyone is having a specific problem such as the app immediately closing (it was doing that to me before), just post it here and I’ll try to help you in the morning.