Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

OpenFeint plugin that works in Unity 3.2

Discussion in 'Android' started by Wozik, Feb 11, 2011.

  1. Falin

    Falin

    Joined:
    Sep 29, 2009
    Posts:
    242
    k yesterday I got openfeint and admob working(at least yesterday). But then I screwed something up. So now I had to do it again and admob works but openfeint doesn't work I get these errors in terminal when ant create-jar:
    Code (csharp):
    1.  [setup] Android SDK Tools Revision 11
    2.     [setup] Project Target: Google APIs
    3.     [setup] Vendor: Google Inc.
    4.     [setup] Platform Version: 1.5
    5.     [setup] API level: 3
    6.     [setup] Project Type: Android Library
    7.     [setup]
    8.     [setup] ------------------
    9.     [setup] Resolving library dependencies:
    10.     [setup] No library dependencies.
    11.     [setup]
    12.     [setup] ------------------
    13.     [setup]
    14.     [setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (6) is higher than the project target API level (3)
    15.     [setup]
    16.     [setup] Importing rules file: tools/ant/lib_rules.xml
    17.  
    18. -dirs:
    19.      [echo] Creating output directories if needed...
    20.  
    21. compile:
    22.     [javac] Compiling 127 source files to /Users/micha/Documents/3DPlatformerTutorialStart_backup/Assets/Plugins/Android/bin/classes
    23.     [javac] /Users/micha/Documents/3DPlatformerTutorialStart_backup/Assets/Plugins/Android/src/com/openfeint/internal/ui/WebNav.java:541: method does not override or implement a method from a supertype
    24.     [javac]         @Override
    25.     [javac]         ^
    26.     [javac] /Users/micha/Documents/3DPlatformerTutorialStart_backup/Assets/Plugins/Android/src/com/openfeint/internal/Util.java:193: cannot find symbol
    27.     [javac] symbol  : variable WRITE_EXTERNAL_STORAGE
    28.     [javac] location: class android.Manifest.permission
    29.     [javac]         return noPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, ctx);
    30.     [javac]                                                ^
    31.     [javac] /Users/micha/Documents/3DPlatformerTutorialStart_backup/Assets/Plugins/Android/src/com/openfeint/internal/Util11.java:17: cannot find symbol
    32.     [javac] symbol  : variable screenLayout
    33.     [javac] location: class android.content.res.Configuration
    34.     [javac]             return (ctx.getResources().getConfiguration().screenLayout  mask) == mask;
    35.     [javac]                                                          ^
    36.     [javac] 3 errors
    37.  
    38. BUILD FAILED
    39. /Users/micha/Documents/3DPlatformerTutorialStart_backup/Assets/Plugins/Android/build.xml:59: Compile failed; see the compiler error output for details.
    40.  
    So help is appreciated :)
     
  2. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    440
    What is the minimum API level for OpenFeint 3.0 Android? I see on this page:
    http://support.openfeint.com/dev/example-integrating-ofunity-for-android-with-unity/

    It says 1.6 at the top, but in the Manifest they provide and in the Screenshot, it shows Level 8 (2.2)?

    Edit: Got a response from OF, it works on previous API's to 1.6, but there is a current issue that wouldn't allow you to 'compile' against 1.6 which is not even possible with Unity anyways to be less than 2.0.1. I mainly just wanted to be sure I could target 2.1, which is 15% of the audience still.
     
    Last edited: Aug 16, 2011
  3. donniedeboer

    donniedeboer

    Joined:
    Sep 1, 2011
    Posts:
    1
    Did you ever figure this out? I'm getting the same error when I try to use OpenFeint with another external .Jar library that requires its own layout files to be under the res/ folder. I think the resource ids are getting hosed.
     
  4. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    I've got a weird problem too with the OpenFeint integration. I followed all steps and basically it's working. The OpenFeintFacade is instantiated and it's Init function gets called. After like 15 second, it times out. I don't know why, but that's not the real problem yet. But the app crashes, when it tries to display the timeout message, because it can't find the string resource.

    Code (csharp):
    1. W/ResourceType(25578): getEntry failing because entryIndex 24 is beyond type entryCount 1
    2. W/ResourceType(25578): Failure getting entry for 0x7f050018 (t=4 e=24) in package 0 (error -2147483647)
    3. D/AndroidRuntime(25578): Shutting down VM
    4. W/dalvikvm(25578): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
    5. E/AndroidRuntime(25578): FATAL EXCEPTION: main
    6. E/AndroidRuntime(25578): android.content.res.Resources$NotFoundException: String resource ID #0x7f050018
    7. E/AndroidRuntime(25578):        at android.content.res.Resources.getText(Resources.java:210)
    8. E/AndroidRuntime(25578):        at android.content.res.Resources.getString(Resources.java:263)
    9. E/AndroidRuntime(25578):        at com.openfeint.internal.OpenFeintInternal.getRString(OpenFeintInternal.java:742)
    10. E/AndroidRuntime(25578):        at com.openfeint.internal.request.BaseRequest.postTimeoutCleanup(BaseRequest.java:337)
    11. E/AndroidRuntime(25578):        at com.openfeint.internal.request.Client$4.run(Client.java:170)
    12. E/AndroidRuntime(25578):        at android.os.Handler.handleCallback(Handler.java:587)
    13. E/AndroidRuntime(25578):        at android.os.Handler.dispatchMessage(Handler.java:92)
    14. E/AndroidRuntime(25578):        at android.os.Looper.loop(Looper.java:143)
    15. E/AndroidRuntime(25578):        at android.app.ActivityThread.main(ActivityThread.java:4196)
    16. E/AndroidRuntime(25578):        at java.lang.reflect.Method.invokeNative(Native Method)
    17. E/AndroidRuntime(25578):        at java.lang.reflect.Method.invoke(Method.java:507)
    18. E/AndroidRuntime(25578):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    19. E/AndroidRuntime(25578):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    20. E/AndroidRuntime(25578):        at dalvik.system.NativeStart.main(Native Method)
    21. W/ActivityManager(  220):   Force finishing activity com.tseng.ThePirateGame/com.unity3d.player.UnityPlayerNativeActivity
    But the string is correct in the opeinfeint's R.java file says:

    Code (csharp):
    1.  
    2. public static final int of_timeout=0x7f050018;
    3.  
    and the of_strings.xml says
    Code (csharp):
    1.  
    2.     <string name="of_timeout">The request didn\'t complete in time.</string>
    3.  
    The jar file is compiled, OpenFeintAPI library included, I even copied all of OpenFeintAPIs res folders into my games Android Project (Plugins/Andorid/res).
     
  5. matt-johnson

    matt-johnson

    Joined:
    May 7, 2009
    Posts:
    67
    Can anyone point me in the right direction for displaying notifications (achievements / progress) at the top of my app (portrait) as opposed to the default bottom which obstructs my UI. Thanks!

    Matt
     
  6. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    Last edited: Oct 6, 2011
  7. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    Anyone know how to subnit a float as a score rather than an int?

    Edit: got solution from Emily at OpenFeint for anyone interested:

    The Score value in our underlying API is a
    long , so there is not a way for you
    to store a float , even in the
    underlying API.

    http://support.openfeint.com/images...ntation/com/openfeint/api/resource/Score.html
    You can use the

    displayText field of the Score to store the text you want to
    display with each score, and you could assign a string that represents
    the float value of the score (and then maybe use fixed decimal to make
    that value into a long for purposes of storing the score
    itself).
    So, for example, if you decided to fix your floats at 2 decimal points
    and someone earned 1.02 points, you'd store that as a long as
    102 and your display text would read
    " 1.02 ".
     
    Last edited: Oct 12, 2011
  8. lbalasubbaiahapps

    lbalasubbaiahapps

    Joined:
    Oct 6, 2011
    Posts:
    23
    i build on my device But i got one issue 1. you are offline i checked also my device its connected to network.
    2.When application open there is no way to exit.i mean when i press back button also i got no action.i wrote a script also i.e if(Input.Getkeydown(keycode.escape)){application.quit();} it's not work.But this is work on normal unityandroid build how can i solve help me.. please
     
  9. Xpoze

    Xpoze

    Joined:
    Oct 28, 2011
    Posts:
    2
    I'm not sure if anyone can help but i was wondering if there was anything like this to retrieve the User high score from the leaderboards and not just the overall High score.
     
  10. Grazer2

    Grazer2

    Joined:
    Jun 20, 2011
    Posts:
    50
    Anybody here who has gotten OpenFeint to work when building the unity game through eclipse as library? Thing is that I need to integrate my unity based game into a 3rd party android app. So now I need to run the unity game as library through eclipse. This part actually works fine, but adding the OpenFeint facade to the project makes it crash without any helpful errors or warnings. Simply building and running the .apk from unity works fine and gets OpenFeint up and running. It's just when I build everything through eclipse that the game simply crashes when around the time it tries to load OF.

    I'm assuming this is due to the eclipse project not finding the OF library, however I'm not really sure on where or how to add the OpenFeint library to eclipse.

    edit: Problems resolved by making sure the host eclipse app includes all used plugins as external jars.
     
    Last edited: Dec 29, 2011
  11. Grazer2

    Grazer2

    Joined:
    Jun 20, 2011
    Posts:
    50
    New question: Can anybody help me out getting the name of a highscore entry out of the openfeint Score object?

    I was basically trying to do the following in my unity c# script:

    Code (csharp):
    1.  
    2. AndroidJavaObject scoreObject = highscoreList.Call<AndroidJavaObject>("get", 0);
    3. AndroidJavaObject userObject = scoreObject.Get<AndroidJavaObject>("user");
    4. string userName = ConvertJavaStringToMonoString(userObject.Get<IntPtr>("name"));
    5.  
    but it seems that
    Code (csharp):
    1. userObject.Get<IntPtr>("name")
    just yields a nullpointer. Retrieving the score as well as the rank works fine, its just the user name that gets me stumped.
     
  12. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    I had a lot of crashing bugs when exiting the OpenFeint dashboard on Android, and eventually tracked the problem to EZ Gui implementation, as documented in this thread. Thought I'd post it for anyone also having random crashes.. The time.realTimeSinceStartup breaks when resuming on Android, apparently.

     
  13. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    This thread has proved useful to me so thanks to all who've contributed. While I didn't actually use the plugin supplied by the OP, it was still useful (especially the readme).

    The only trouble I had was using UnityPlayer.UnitySendMessage to send messages back to C#. I always had a compile error even though I was importing com.unity3d.player.UnityPlayer.

    The solution, for those interested, was to modify the build.xml by adding this line to the compile tag:
    <fileset dir="${external.libs.unity.dir}" includes="*.jar" />

    and this line to build.properties:
    external.libs.unity.dir=/Program Files (x86)/Unity/Editor/Data/PlaybackEngines/androidplayer/bin

    Obviously change that to point to your unity install directory.
     
  14. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I was using the newest open feint, it doesnt play nice with prime31 plugins because the MiniJson files are different and the only thing that seems to be different is one is calling it JsonDecode/JsonEncode and the other jsonDecode/jsEncode. I deleted one of them and made the changes and it seems to work
     
  15. FiveFingers

    FiveFingers

    Joined:
    Oct 15, 2009
    Posts:
    540
    We will post soon an Universal Update for MadOBall3D Zero HD which supports both OpenFeint and our "force feedback" vibration and adMob plugins for you to see (app its free).

    All is working nicely.

    Using the latest adMobGoogle 4.3.1 and Android Unity OpenFeint 3.1 plug-in package.
     
    Last edited: Apr 19, 2012
  16. kickerks8080

    kickerks8080

    Joined:
    Feb 23, 2010
    Posts:
    10
    For anyone who needs a AndroidManifest.xml file that supports Prime31 flurry plugin and Openfeint use this.

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    android:installLocation="preferExternal"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="7" />
    <supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:xlargeScreens="true" />

    <!-- PERMISSIONS -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
    android:debuggable="true"
    android:icon="@drawable/app_icon"
    android:label="@string/app_name" >
    <activity android:name="com.gree.giraffe.BaseActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    <!-- WILL NEED TO REFACTOR TO MAKE com.gree.giraffe.BaseActivity the MAIN ACTIVITY (It extends from UnityPlayerActivity)
    <activity
    android:name="com.unity3d.player.UnityPlayerProxyActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    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.unity3d.player.UnityPlayerActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:label="@string/app_name" >
    </activity>
    <activity
    android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:label="@string/app_name" >
    <meta-data
    android:name="android.app.lib_name"
    android:value="unity" />
    <meta-data
    android:name="unityplayer.ForwardNativeEventsToDalvik"
    android:value="false" />
    </activity>
    <activity
    android:name="com.unity3d.player.VideoPlayer"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:label="@string/app_name" >
    </activity>

    <!-- ACTIVITIES -->
    <activity
    android:name="com.flurry.android.CatalogActivity"
    android:theme="@android:style/Theme.Translucent" >
    <intent-filter>
    <action android:name="make.me.unique.please" />

    <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    </activity>
    <!-- OpenFeint Activities -->
    <activity android:name="com.openfeint.internal.ui.IntroFlow"
    android:label="IntroFlow"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@style/OFNestedWindow" />
    <activity android:name="com.openfeint.api.ui.Dashboard"
    android:label="Dashboard"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@style/OFNestedWindow"/>
    <activity android:name="com.openfeint.internal.ui.Settings"
    android:label="Settings"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@style/OFNestedWindow"/>
    <activity android:name="com.openfeint.internal.ui.NativeBrowser"
    android:label="NativeBrowser"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@style/OFNestedWindow"/>

    <!-- ofx activity -->
    <activity
    android:configChanges="orientation|keyboardHidden"
    android:label="Please confirm your account"
    android:name="com.openfeint.ofx.activity.AttachAccountActivity"
    android:theme="@style/OFNestedWindow" />
    <activity
    android:configChanges="orientation|keyboardHidden"
    android:label="Please secure your account"
    android:name="com.openfeint.ofx.activity.SecureAccountActivity"
    android:theme="@style/OFNestedWindow" />
    <activity
    android:configChanges="orientation|keyboardHidden"
    android:name="com.openfeint.ofx.activity.ChooseAccountFlowActivity"
    android:theme="@style/OFNestedWindow" />

    <!-- use ofx service and receiver -->
    <service android:name="com.openfeint.ofx.service.BillingService" />

    <receiver android:name="com.openfeint.ofx.broadcastreceiver.BillingReceiver" >
    <intent-filter >
    <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
    <action android:name="com.android.vending.billing.RESPONSE_CODE" />
    <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
    </intent-filter>
    </receiver>

    <!-- META-DATA -->

    </application>

    </manifest>
     
  17. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Now that openfeint has been discontinued what is everyone using for leaderboards?
     
  18. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    440
    I put Heyzap in recently, they have a Unity plugin for it and its cross platform.
     
  19. Dragonfist111

    Dragonfist111

    Joined:
    Jul 7, 2012
    Posts:
    23
unityunity