OpenFeint

Monkey Targets Forums/Android/OpenFeint

MonkeyPig(Posted 2011) [#1]
[EDIT] - There's a more compact solution down below.

I've got a first pass of OpenFeint working with my Monkey App. Tested in MonkeyPro44 and 46

Right now Leaderboards and Achievements are working. The code is kinda sloppy. I've not done much (any) Java code so comments/corrections and - especially - improvements definitely welcome.

Okay, so here we go...

OpenFeint for Monkey...
--------------------------

Step 1...

Install the OpenFeint SDK as per the instructions on the OpenFeint website.

You should follow the steps all the way through to getting the sample app installed on your device.

My API install path looks like this.

c:\mpp\OpenFient\OpenFeintAPI

You may need to change some of the relative pathing if you deviate from a similar path structure.

Step 2...

Edit...

\YOURPATH\MonkeyPro??\targets\android\build.properties

Add the following lines...
android.library.reference.1=../../../OpenFeint/OpenFeintAPI/
android.library.reference.2=../../../OpenFeint/GameFeed/


CORRECTION: You need to add the above pathing to your local app build.properties.

NOTE the relative pathing from my App/App.build/Android dir.

Edit
/YOURPATH/MonkeyPro??/targets/android/templates/AndroidManifest.xml

Add the following lines...
        <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"/>

At the end of the </application> tag add the following permissions...

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

Some of these are optional but you might as well set them all...

NOTE: These changes should probably go to your project directory. Other Android projects you have will likely fail to build if they can't find all the OpenFeint stuff.
--------------------------------

Interfacing with monkey...

You'll need to create an native java extension for Android...

extensions.monkey

#If TARGET="android" Then

	Import "MPPNet.java"

	Function MPPNetInit:Void(appName:String, clientAppID:String, productKey:String, productSecret:String)="MPPNet.Init"
	Function MPPNetIsUserLoggedIn:Bool()="MPPNet.IsUserLoggedIn"

	Function MPPNetPostScore:Void(score:Int, id:String)="MPPNet.PostScore"
		
	Function MPPNetOpenSocial:Void()="MPPNet.OpenSocial"
	Function MPPNetOpenLeaderboards:Void()="MPPNet.OpenLeaderboards"
	Function MPPNetOpenAchievements:Void()="MPPNetAchievements.Open"
	Function MPPNetAwardAchievement:Void(id:String)="MPPNetAchievements.Award"
#endif

Create your MPPNet.java file and paste the following code into it...

MPPNet.java


And to use in your game you first need to initialise OpenFeint...
#if TARGET="android"

	MPPNetInit(YouAppName, YouAppClientID,  YourAppID, YourAppSecret)

#endif


To open the main OpenFeintInterface...

MPPNetOpenSocial();

To open the OpenFeint leaderboard screen...
MPPNetOpenLeaderboards();

To view the Achievements...
MPPNetOpenAchievements();

MPPNetPostScore(score, "YourLeaderboardID");

MPPNetAwardAchievement("YourAchievementID");


TODO:

The changes to the android.manifest should really be on a project by project basis.
The example files no longer build with my current directory structure (where I install openfeint)

c:\mpp\OpenFient\OpenFeintAPI

Make it a nice module.

Add iOS support.
Add fallbacks for everything else.

WARNING: there's a lot of bits and pieces in here so I may have missed something. I developed in MP44 and migrated changes to 46 making notes - and then tested so hopefully I got the lot.


c.k.(Posted 2011) [#2]
This is great! THANK YOU!

Can't wait to use it. :)


pantson(Posted 2011) [#3]
fantastic. great work.

i was looking at plugging into ScoreLoop but not having much luck. Saves me some work now.

many thanks


pantson(Posted 2011) [#4]
Hi
tried the instructions above a get an error..
On the MPPNetInit line in my code I get a "Syntax Error - Expecting declaration" during compilation
If I comment that line out, the code compiles fine.

I call that line inside my initialization code for the game... does this need to be at the top of the code?

Also I've created extensions.monkey and placed that in my project root folder.
How and when does this get called?

EDIT: also I dont seem to see MPPnet.java being compiled in the output log
Translating ss
C:/Monkey/bin/trans_winnt -config=release -target=android -run D:/dev/ss/ss.monkey

TRANS monkey compiler V1.15
Parsing...
Semanting...
Translating...
Building...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Buildfile: D:\dev\ss\ss.build\android\build.xml
    [setup] Android SDK Tools Revision 11
    [setup] Project Target: Android 2.1-update1
    [setup] API level: 7
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] D:\dev\ss\ss.build\android: ../../../OpenFeint/OpenFeintAPI/ => D:\dev\OpenFeint\OpenFeintAPI
    [setup] D:\dev\ss\ss.build\android: ../../../OpenFeint/GameFeed/ => D:\dev\OpenFeint\GameFeed
    [setup] D:\dev\OpenFeint\GameFeed: ../OpenFeintAPI => D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] Ordered libraries:
    [setup] D:\dev\OpenFeint\GameFeed
    [setup] D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] 
    [setup] 
    [setup] Importing rules file: tools\ant\main_rules.xml

clean:
   [delete] Deleting directory D:\dev\ss\ss.build\android\bin
   [delete] Deleting directory D:\dev\ss\ss.build\android\gen

BUILD SUCCESSFUL
Total time: 1 second
Buildfile: D:\dev\ss\ss.build\android\build.xml
    [setup] Android SDK Tools Revision 11
    [setup] Project Target: Android 2.1-update1
    [setup] API level: 7
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] D:\dev\ss\ss.build\android: ../../../OpenFeint/OpenFeintAPI/ => D:\dev\OpenFeint\OpenFeintAPI
    [setup] D:\dev\ss\ss.build\android: ../../../OpenFeint/GameFeed/ => D:\dev\OpenFeint\GameFeed
    [setup] D:\dev\OpenFeint\GameFeed: ../OpenFeintAPI => D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] Ordered libraries:
    [setup] D:\dev\OpenFeint\GameFeed
    [setup] D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] 
    [setup] 
    [setup] Importing rules file: tools\ant\main_rules.xml

-debug-obfuscation-check:

-set-debug-mode:

-compile-tested-if-test:

-pre-build:

-dirs:
     [echo] Creating output directories if needed...
    [mkdir] Created dir: D:\dev\ss\ss.build\android\bin
    [mkdir] Created dir: D:\dev\ss\ss.build\android\gen
    [mkdir] Created dir: D:\dev\ss\ss.build\android\bin\classes

-aidl:
     [echo] Compiling aidl files into Java classes...

-renderscript:
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...

-resource-src:
     [echo] Generating R.java / Manifest.java from the resources...

-pre-compile:

compile:
    [javac] d:\dev\android-sdk\tools\ant\main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 199 source files to D:\dev\ss\ss.build\android\bin\classes
    [javac] Note: D:\dev\ss\ss.build\android\src\com\pantson\gpss\MonkeyGame.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

-post-compile:

-obfuscate:

-dex:
     [echo] Converting compiled files and external libraries into D:\dev\ss\ss.build\android\bin\classes.dex...

-package-resources:
     [echo] Packaging resources
     [aapt] Creating full resource package...

-package-debug-sign:
[apkbuilder] Creating MonkeyGame-debug-unaligned.apk and signing it with a debug key...

debug:
     [echo] Running zip align on final apk...
     [echo] Debug Package: D:\dev\ss\ss.build\android\bin\MonkeyGame-debug.apk

install:
     [echo] Installing D:\dev\ss\ss.build\android\bin\MonkeyGame-debug.apk onto default emulator or device...
     [exec] 	pkg: /data/local/tmp/MonkeyGame-debug.apk
     [exec] Success
     [exec] 1327 KB/s (1596279 bytes in 1.174s)

BUILD SUCCESSFUL
Total time: 43 seconds

Process Complete

many thanks


pantson(Posted 2011) [#5]
update..
my MMNetInit() was in the wrong place.. should not be at the top of the code, but clearly in a function.. ie OnCreate()

Now I get a MPPNetInit() not found error.

I think goes back to the how does extension.monkey get called? (is it in the correct place: project root folder?)

regards


FlameDuck(Posted 2011) [#6]
The code is kinda sloppy. I've not done much (any) Java code so comments/corrections and - especially - improvements definitely welcome.
Could you maybe post it in a SCM repository to make it easier for people to play around with? Most people around here seem to use github, but bitbucket, and googlecode are also viable alternatives.


pantson(Posted 2011) [#7]
tis a shame..
I'm getting even more errors during compiling time
[aapt.exe] D:\dev\OpenFeint\OpenFeintAPI\res\layout\of_achievement_notification.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/of_achievement_notification_bkg').
 [aapt.exe] D:\dev\OpenFeint\OpenFeintAPI\res\layout\of_achievement_notification.xml:6: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/of_achievement_icon_unlocked').
 [aapt.exe] D:\dev\OpenFeint\OpenFeintAPI\res\layout\of_achievement_notification.xml:7: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/of_achievement_icon_frame').
 [aapt.exe] D:\dev\OpenFeint\OpenFeintAPI\res\layout\of_achievement_notification.xml:10: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/of_feint_points_white').
 [aapt.exe] D:\dev\OpenFeint\OpenFeintAPI\res\layout\of_achievement_notification.xml:11: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/of_achievement_notification_locked').


Can you post up your entire androidmanifest file please?

Has anyone else got this installed?


MonkeyPig(Posted 2011) [#8]
Sorry - been out all day today.

I'll need to go over the compile issues listed more carefully before responding specifically.

@FlameDuck - I'm using Kiln. I'll look at what's involved with making a repository in googlecode.

My android manifest is the default Monkey one with just those changes listed. But here it is anyway...

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

	package="${APP_PACKAGE}"
	
	android:versionCode="1"
	android:versionName="1.0"
	android:installLocation="auto">
	
	<uses-sdk 
		android:minSdkVersion="3"
		android:targetSdkVersion="7" />
		
	<uses-feature android:glEsVersion="0x00010001" />
		
	<application android:label="${APP_LABEL}" android:icon="@drawable/icon">
		<activity 
			android:name="MonkeyGame" 
			android:label="${APP_LABEL}"
			android:screenOrientation="${SCREEN_ORIENTATION}"
			android:configChanges="keyboardHidden|orientation"
			android:theme=\"@...;
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
        </activity>
        <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"/>

	</application>

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

</manifest> 
          




pantson(Posted 2011) [#9]
cheers
very interested in getting this working and helping improve it.


MonkeyPig(Posted 2011) [#10]
@pantson

The extensions.monkey can be called whatever you like. It's where I add my native platform extensions. You need to put the contents listed above into a file called (your)extensions.monkey...

Then you need to include it into your code. I do it like this...


Import extensions.monkey

' Main App Startup
Function Main:Int()

'
' My App Init code
'

			
#if TARGET="android"
	MPPNetInit("My App Name", "My Client Key",  "My App Key", "My App Secret")
#endif

	Return 0
	
End Function



MonkeyPig(Posted 2011) [#11]
Can anyone who's having a problem confirm that they build the OpenFeint sample code and managed to run it on their device. Follow the steps for the command line build (adb - not eclipse).

I did it as part of the process and - it's an essential debugging tool. Also - confirms that you've got all the OpenFeint stuff installed correctly.


MonkeyPig(Posted 2011) [#12]
Okay - here's a simple sample app that wraps what is outlined above...



You still need to install the OpenFeint Libs as before.

However building this small app did reveal a minor (ahem) problem with what I outlined above. You need to add the directories to your project build.properties. I assumed it was copying them from Monkey directories - but I guess not.

So to clarify...

\YourApp\yourapp.build\android\build.properties

Add the following lines...
android.library.reference.1=../../../OpenFeint/OpenFeintAPI/
android.library.reference.2=../../../OpenFeint/GameFeed/


You still need to create the MPPNet.java file in your source tree.

When you compile and build you get three rectangles; Red; Green and Blue. Touch each will take you to The Main OpenFeint menu; the leaderboards or the achievements.

Good luck.


pantson(Posted 2011) [#13]
Many thanks for all your help and posts monkeypig.

after 3 days of following your instructions and playing around with numerous error messages I can gladly say I've got this compiling and displaying the OpenFient wait logo in the game.

Bizarrely, after all the playing around.. I reinstalled Monkey v46 and followed your instructions, and now all compiles. many thanks

Time to play further and hopefully improve the lib


pantson(Posted 2011) [#14]
First update
new function in Monkey. Opens a particular leaderboard, ideal for game specific leaderbaords
MPPNetOpenLeaderboard(leaderboardID:String)


add the following to extensions
	Function MPPNetOpenLeaderboard:Void(leaderboardID:String)="MPPNet.OpenLeaderboard"


add the following to MPPNet.java
	public static void OpenLeaderboard(String leaderboardID)
	{
	Dashboard.openLeaderboard(leaderboardID);
	}



pantson(Posted 2011) [#15]
not sure if you are interested, but I've started making this into a module.


MikeHart(Posted 2011) [#16]
Module? That would be awesome.


MonkeyPig(Posted 2011) [#17]
Yeah module makes sense.

A standalone Module is part of my longer term plans - but wanted to get the OFX (in-app purchase) and GameFeed working across Android and iOS. My plan is to abstract an interface so, from the Monkey end, you're opening leaderboards, awarding achievements and buying stuff in a back-end agnostic way.

I have the GameFeed code kinda working - but have yet to figure out how to put the feed over the Monkey Game display. Right now it replaces my MonkeyView.

Unfortunately I've got many other, more pressing, issues to work on so it's low on my TODO list.

If you're interested I'll post the code I have for the GameFeed.


pantson(Posted 2011) [#18]
module done... would love to see the feed code.
No iOS code yet. If anyone wants to buy me a MAC I can crack on with it ;-)
seriously, I'll try to look at some iOS code (but will be guessing).


MonkeyPig(Posted 2011) [#19]
Pantson,

Okay here's what I have on the Game Feed...

This code is added to MPPNet.java



This is added to your extensions.monkey

	Function	MPPGameFeedInit:Void()="MPPNet.GameFeedInit"


In the App side I test if OpenFeint is logged in and if it is I launch the game feed with when the user touches a button MPPGameFeedInit()...

Now - unfortunately - the code by itself won't do much. You need to copy all of the various Android/res stuff from the OpenFeint/GameFeed example directories into your app android/res directories.

It should build and run at that point.

In my test app I get the gamefeed displaying but - there's no activity (not too surprising as - well - there is no activity at the moment).

The problem I have is that the gamefeed obliterates my Monkey View. I played with the java res stuff for a little while - but didn't fix it in the time I had alloted. If you don't make any headway - I'll probably revisit soon(ish) but my priority is to get iOS working with the basics and other to investigate other solutions for Flash/HTML5/PC etc.

There's no easy way to make this a simple Monkey file because of the res dependencies. So... if you can't get it working - I'll archive my test tree and make it available...


MonkeyPig(Posted 2011) [#20]
Ah - forgot this.

I created this file - in an attempt to show some content underneath...

res/layout/gamefeed_monkey.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
	android:layout_height="128px"
	android:orientation="vertical"
 	android:id="@+id/monkeyview">

    <Button android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:text="Toggle GameFeed"
		android:layout_gravity="center" android:id="@+id/button_toggle_gamefeed"></Button>
</LinearLayout>



I was hoping I'd be able to avoid having to dig too deep into the Android SDK (one of the reasons I'm using Monkey) - but the more you try to do the more it would appear you have to dig deep to figure out how Android SDK is supposed to work...


pantson(Posted 2011) [#21]
cheers for that
yeah I've also found that if you want to plug into other libs then you have to play around with the xml. Something that monkey wont do from the code..

I'll have a play. many thanks


pantson(Posted 2011) [#22]
Hi MonkeyPig
Is that all the code for the java file? its generating a lot of errors on compilation and I dont see the MPPNet.GameFeedInit function in the java code.


MonkeyPig(Posted 2011) [#23]
@pantson

No - I just cut the part out that you needed to add to the existing MPPNet.java. Just cut & paste the above member function and member variables to your current local copy of MPPNet.java.


pantson(Posted 2011) [#24]
thats strange... I'm getting this error
    [javac] Compiling 199 source files to D:\dev\sshuffle\ss.build\android\bin\classes
    [javac] D:\dev\sshuffle\ss.build\android\src\com\appytimes\gpss\MonkeyGame.java:1863: cannot find symbol
    [javac] symbol  : class GameFeedView
    [javac] location: class com.appytimes.gpss.MPPNet
    [javac]     private static GameFeedView gameFeedView;
    [javac]                    ^
    [javac] D:\dev\sshuffle\ss.build\android\src\com\appytimes\gpss\MonkeyGame.java:1867: cannot find symbol
    [javac] symbol  : class Drawable
    [javac] location: class com.appytimes.gpss.MPPNet
    [javac]         private static Drawable loadBitmap(int id)

Its like I'm not including the gamefeed library.
Is it just the res stuff from the gamefeed example I'm copying (or the src too)? PS I've tried both


MonkeyPig(Posted 2011) [#25]
I think I forgot to mention this, but did you add...

android.library.reference.2=../../../OpenFeint/GameFeed/

to your build.properties file?


pantson(Posted 2011) [#26]
cheers bit thats there from the original instructions.

I've placed the java code in the MPPnet class. Is that correct? (I've also placed it everywhere else in the file too)


MonkeyPig(Posted 2011) [#27]
Ah - yeah it's probably that you're just missing the includes at the top...

import com.openfeint.api.OpenFeint;
import com.openfeint.api.OpenFeintDelegate;
import com.openfeint.api.OpenFeintSettings;
import com.openfeint.api.resource.Achievement;
import com.openfeint.api.resource.Leaderboard;
import com.openfeint.api.resource.Score;
import com.openfeint.api.ui.Dashboard;
import com.openfeint.internal.OpenFeintInternal;

//
// Game Feed Stuff
import com.openfeint.gamefeed.GameFeedSettings;
import com.openfeint.gamefeed.GameFeedView;


I guess that's the problem with just cutting & pasting the bits I think you need versus the bits you actually need. Sorry.

If that doesn't work I'll just cut & paste my current MPPNet.java - you'll need to add your changes back then.


pantson(Posted 2011) [#28]
yep.. just found out myself ;-)
cheers


MonkeyPig(Posted 2011) [#29]
Cool. Good luck.


pantson(Posted 2011) [#30]
unfortunately... its the Drawable class now.
   [javac] Compiling 199 source files to D:\dev\sshuffle\ss.build\android\bin\classes
    [javac] D:\dev\sshuffle\ss.build\android\src\com\pantson\gpss\MonkeyGame.java:1870: cannot find symbol
    [javac] symbol  : class Drawable
    [javac] location: class com.pantson.gpss.MPPNet
    [javac]         private static Drawable loadBitmap(int id)
    [javac]                        ^
    [javac] D:\dev\sshuffle\ss.build\android\src\com\pantson\gpss\MonkeyGame.java:1873: cannot find symbol
    [javac] symbol  : class BitmapDrawable
    [javac] location: class com.pantson.gpss.MPPNet
    [javac]             return bitmap != null ? new BitmapDrawable(bitmap) : null;
    [javac]                                         ^
    [javac] D:\dev\sshuffle\ss.build\android\src\com\pantson\gpss\MonkeyGame.java:1907: cannot find symbol
    [javac] symbol  : variable gamefeed_monkey
    [javac] location: class com.pantson.gpss.R.layout
    [javac]                 layoutId = R.layout.gamefeed_monkey;


maybe we should start a code archive. so thats it easier to pass code between ourselves.


MonkeyPig(Posted 2011) [#31]
Here's the entire set of includes I have now in MPPNet...


import java.util.HashMap;
import java.util.List;
import java.util.Map;

//import android.app.Application;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.openfeint.api.OpenFeint;
import com.openfeint.api.OpenFeintDelegate;
import com.openfeint.api.OpenFeintSettings;
import com.openfeint.api.resource.Achievement;
import com.openfeint.api.resource.Leaderboard;
import com.openfeint.api.resource.Score;
import com.openfeint.api.ui.Dashboard;
import com.openfeint.internal.OpenFeintInternal;

//
// Game Feed Stuff
import com.openfeint.gamefeed.GameFeedSettings;
import com.openfeint.gamefeed.GameFeedView;



From your errors - it looks like you're missing the Android ones.

Probably would have been simpler to just upload my current MPPNet.java but I've got a bunch of random crap in there when I was trying to get the GameFeed to display on top of my view.


pantson(Posted 2011) [#32]
wow theres a lot more android libs.
cheers. that fixed it.

now its time to play ;-)


pantson(Posted 2011) [#33]
spoke too soon ;-)
MPPNet.GameFeedInit not found and I don't see it in the java code you posted.
Do you have this function please?


MonkeyPig(Posted 2011) [#34]
Whoops. Stick this method into your MPPNet.java file too...

        public static void GameFeedInit()
        {
            GameFeed();
        }


It's a member function of the MPPNet class.

The code I'm cutting & pasting from is a bit of disaster area at the moment - as I tried many different things to get the display working.


pantson(Posted 2011) [#35]
sounds like my dev work ;-)
cheers


MonkeyPig(Posted 2011) [#36]
Glad to hear it's working. Sorry it took so many back and forths.


pantson(Posted 2011) [#37]
Is it time start a Google code (with live and beta releases)?


MonkeyPig(Posted 2011) [#38]
One of the problems with making a google repository is that there's an awful lot of messy OpenFeint dependencies.

I don't see any simple/clean way to package it up and have a module that'll work without adding all of the Android directories that need the OpenFeint resources. Perhaps there a better way?

Does anyone know of a way to put Android resources in your project tree - or do we have to modify the app.build directory?


pantson(Posted 2011) [#39]
still here.. just been busy


pantson(Posted 2011) [#40]
FYI
the lib doesn't seem to work in v47.

Its something to with the build.properties or ant.properties file.
Still looking into it


MonkeyPig(Posted 2011) [#41]
Hi Pantson,

Not been Monkeying around for a few weeks. Working on native iOS stuff (non Monkey).

I've not updated yet to v47. From what I've read though - I would have thought you'd just apply the changes outlined and it should work. Is there a specific error?


pantson(Posted 2011) [#42]
Hi

it looks like the build.properties file doesn't exist. Its now called ant.properties. So I've copied the relevant info in.

Now when compiling it states that there is no project.properties in the gamefeed and API dir.

After creating the project.properties files, it states that the build.xml is out of date.

Its like it trying to compile them again in V47 rather than using the src files


Xaron(Posted 2012) [#43]
Hi,

is there already a module for this? And it seems that posting No. 1 does not include all additions (like GameFeed)? Could you please add this to your first posting as well MonkeyPig?

Thanks!


Xaron(Posted 2012) [#44]
Well I get this, after setting up ant.properties instead of build.properties with Monkey V52:

BUILD SUCCESSFUL
Total time: 0 seconds
Buildfile: D:\Projekte\oftest\of.build\android\build.xml

-set-mode-check:

-set-debug-files:

-set-debug-mode:

-debug-obfuscation-check:

-setup:
     [echo] Gathering info for MonkeyGame...
    [setup] Android SDK Tools Revision 16
    [setup] Project Target: Android 3.2
    [setup] API level: 13
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] D:\Projekte\oftest\of.build\android: OpenFeint/OpenFeintAPI/ => D:\Projekte\oftest\of.build\android\OpenFeint\OpenFeintAPI
    [setup] D:\Projekte\oftest\of.build\android: OpenFeint/GameFeed/ => D:\Projekte\oftest\of.build\android\OpenFeint\GameFeed
    [setup] D:\Projekte\oftest\of.build\android\OpenFeint\GameFeed: ../OpenFeintAPI => D:\Projekte\oftest\of.build\android\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] Ordered libraries:
    [setup] D:\Projekte\oftest\of.build\android\OpenFeint\GameFeed
    [setup] D:\Projekte\oftest\of.build\android\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] 
    [setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (3) is lower than the project target API level (13)

-build-setup:
     [echo] Building Libraries
ERROR:
BUILD FAILED
D:\Programme\Android\android-sdk\tools\ant\build.xml:485: The following error occurred while executing this line:
D:\Projekte\oftest\of.build\android\OpenFeint\OpenFeintAPI\build.xml:49: taskdef class com.android.ant.SetupTask cannot be found
 using the classloader AntClassLoader[]



pantson(Posted 2012) [#45]
ah yes.... I got this too
unlike older versions Monkey has to compile the libraries too and not reply on pre-compiled libs.
This took a while for me to sort.. but heres my batch file I run in the Android build folder to prep the project
xcopy ..\..\..\OpenFeint\OpenFeintAPI\res res /E /Y
xcopy ..\..\..\OpenFeint\GameFeed\res res /E /Y

echo android.library.reference.1=../../../OpenFeint/OpenFeintAPI/ >ant.properties
echo android.library.reference.2=../../../OpenFeint/GameFeed/ >>ant.properties
call d:\dev\bin\android-sdk\tools\android.bat update project -p /

pushd ..\..\..\OpenFeint
call d:\dev\bin\android-sdk\tools\android.bat update project -p OpenFeintAPI/ -t 1
call d:\dev\bin\android-sdk\tools\android.bat update project -p GameFeed/ -t 1
popd
pause

This should prep the Monkey project for compiling with OpenFient and Gamefeed (builds ant.properties, copies over the res folders and tells android about openfient libs)

Note the paths.. for me
d:/dev/project/project.build/android
d:/dev/bin/android-sdk
d:/dev/openfient/gamefeed
d:/dev/openfient/openfient

You may have to change the paths in the above batch file to accommodate the paths on your machine


pantson(Posted 2012) [#46]
PS I have some kind of module... but its loaded with code for my projects and not really global for everyone (relies on my own modules that I dont want to release)


Xaron(Posted 2012) [#47]
You are awesome, Rich!

Well ok, let me see if I understand correctly. I just build everything with monkey, then I apply your script which runs fine.

After that I need to compile the project again I think? If I do so with Monkey I get:


-build-setup:
     [echo] Building Libraries
Trying to override old definition of task setupERROR:
BUILD FAILED
D:\Programme\Android\android-sdk\tools\ant\build.xml:485: The following error occurred while executing this line:
D:\Projekte\oftest\of.build\android\OpenFeint\OpenFeintAPI\build.xml:65: 

Error. You are using an obsolete build.xml
You need to delete it and regenerate it using
	android update project


Total time: 0 seconds
ERROR:



Xaron(Posted 2012) [#48]
My batch file:

xcopy OpenFeint\OpenFeintAPI\res res /E /Y
xcopy OpenFeint\GameFeed\res res /E /Y

echo android.library.reference.1=OpenFeint/OpenFeintAPI/ >ant.properties
echo android.library.reference.2=OpenFeint/GameFeed/ >>ant.properties
call D:\Programme\Android\android-sdk\tools\android.bat update project -p /

pushd OpenFeint
call D:\Programme\Android\android-sdk\tools\android.bat update project -p OpenFeintAPI/ -t 1
call D:\Programme\Android\android-sdk\tools\android.bat update project -p GameFeed/ -t 1
popd
pause


output:




Xaron(Posted 2012) [#49]
Oh and by the way: If I want to enable an OpenFeint application it says (within OpenFeint): An error has occurred. a leaderboard or achievement must exist.

So how do I create a leaderboard? I just can't find it on their website...


Xaron(Posted 2012) [#50]
Hmm... WTF?

Now I have a different error which is obvious:

In MonkeyGame.java line 3:


//${PACKAGE_BEGIN}
package ;
//${PACKAGE_END}



pantson(Posted 2012) [#51]
Hi

2 things...

delete the build.xml from openfeint and gamefeed dirs and rerun the script.
It looks like your build.xml files need updating too.
build.xml: Failed to find version-tag string. File must be updated.
In order to not erase potential customizations, the file will not be automatically regenerated.
If no changes have been made to the file, delete it manually and run the command again.
If you have made customizations to the build process, the file must be manually updated.
It is recommended to:
        * Copy current file to a safe location.
        * Delete original file.
        * Run command again to generate a new file.
        * Port customizations to the new file, by looking at the new rules file
          located at <SDK>/tools/ant/build.xml
        * Update file to contain
              version-tag: custom
          to prevent file from being rewritten automatically by the SDK tools.
----------


To create a leaderboard in OF
1) Create a gane/app
2) make sure its selected
3) Click on Features tab
4) Cliak on Leadreboards
5) Add a leaderboard (you can have multiple leaderboards per game)

Not sure what that java error is.. I've never seen it before, sorry


Xaron(Posted 2012) [#52]
Just to clarify (again):

I have my project which I build with Monkey (which fails then of course).

AFTER that I run your script.

Then I build the project with Monkey again?

The warnings regarding the build.xml are gone after deleting them but the compile error remains:

-compile:
    [javac] Compiling 2 source files to D:\Projekte\oftest\of.build\android\bin\classes
    [javac] D:\Projekte\oftest\of.build\android\src\MonkeyGame.java:3: <identifier> expected
    [javac] package ;
    [javac]        ^
    [javac] 1 errorERROR:
BUILD FAILED
D:\Programme\Android\android-sdk\tools\ant\build.xml:602: The following error occurred while executing this line:
D:\Programme\Android\android-sdk\tools\ant\build.xml:622: Compile failed; see the compiler error output for details.


The error is simple. It just adds the line

package ;


which can't be compiled because there is no such package (empty)... I just wonder where this come from.

Do you mind to post a zip of a complete example including the extensions.monkey and MPPNet.java files? I just tried the example from MonkeyPig above.


Xaron(Posted 2012) [#53]
Or to rephrase my question: If I only want to make a leaderboard for now, is it enough to add everything from the initial posting #1?


Xaron(Posted 2012) [#54]
Oh guess what? Had a typo in your script!

Well ok, now I get the following error, lol:

-compile:
    [javac] Compiling 135 source files to D:\Projekte\OpenFeint\OpenFeintAPI\bin\classes
    [javac] D:\Projekte\OpenFeint\OpenFeintAPI\src\com\openfeint\internal\Util.java:233: cannot find symbol
    [javac] symbol  : variable WRITE_EXTERNAL_STORAGE
    [javac] location: class android.Manifest.permission
    [javac]         return noPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, ctx);
    [javac]                                                ^
    [javac] D:\Projekte\OpenFeint\OpenFeintAPI\src\com\openfeint\internal\Util11.java:18: cannot find symbol
    [javac] symbol  : variable screenLayout
    [javac] location: class android.content.res.Configuration
    [javac]             return (ctx.getResources().getConfiguration().screenLayout & mask) == mask;
    [javac]                                                          ^
    [javac] 2 errorsERROR:
BUILD FAILED
D:\Programme\Android\android-sdk\tools\ant\build.xml:485: The following error occurred while executing this line:
D:\Programme\Android\android-sdk\tools\ant\build.xml:602: The following error occurred while executing this line:
D:\Programme\Android\android-sdk\tools\ant\build.xml:622: Compile failed; see the compiler error output for details.

Total time: 4 seconds
ERROR:


Looks like some problem with the manifest? Don't know, here it is:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="${APP_PACKAGE}"
	android:versionCode="7"
	android:versionName="1.0.6"
	android:installLocation="auto">
	<supports-screens android:resizeable="false"
                    android:smallScreens="true"
                    android:normalScreens="true"
                    android:largeScreens="true"
                    android:anyDensity="true" />

 	<uses-sdk 
		android:minSdkVersion="3"
		android:targetSdkVersion="7" />

  <uses-feature android:glEsVersion="0x00010001" />
	<application android:label="${APP_LABEL}" android:icon="@drawable/icon">
		<activity 
			android:name="MonkeyGame" 
			android:label="${APP_LABEL}"
			android:screenOrientation="${SCREEN_ORIENTATION}"
			android:configChanges="keyboardHidden|orientation"
			android:theme=\"@...;
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>
        <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"/>
	</application>
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> 



pantson(Posted 2012) [#55]
I' not getting that error in java.util at all.. heres my manifest file..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

	package="${APP_PACKAGE}"

	android:versionCode="11"
	android:versionName="3.23"
	android:installLocation="auto">

	<uses-sdk
		android:minSdkVersion="3"
		android:targetSdkVersion="7" />

	<uses-feature android:glEsVersion="0x00010001" />

	<application android:label="${APP_LABEL}" android:icon="@drawable/icon">
		<activity
			android:name="MonkeyGame"
			android:label="${APP_LABEL}"
			android:screenOrientation="${SCREEN_ORIENTATION}"
			android:configChanges="keyboardHidden|orientation"
			android:theme=\"@...;
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>
	<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"/>
    <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
	      	</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>


maybe redownload the api from openfeint again. unless there is a new one and mine will crash. I will have a look.

PS setting up a leaderboard should be sufficient to use the code.


pantson(Posted 2012) [#56]
checked download and I already have the latest


Xaron(Posted 2012) [#57]
Rich thanks,

Just to clarify (again):

I have my project which I build with Monkey (which fails then of course).

AFTER that I run your script.

Then I build the project with Monkey again?

As there are so many changes in this thread: If I only want to make a leaderboard for now, is it enough to add everything from the initial posting #1?


pantson(Posted 2012) [#58]
yes.. build the project (which will fail) and then run the script which should then setup your ant.properties and extra stuff.
Compile your project again (and it should compile)

All the stuff in post #1 should still be valid.
there maybe more imports for MPPNet.android.java. Heres my import... (not all the code as it wont work for you)

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.openfeint.api.OpenFeint;
import com.openfeint.api.OpenFeintDelegate;
import com.openfeint.api.OpenFeintSettings;
import com.openfeint.api.resource.Achievement;
import com.openfeint.api.resource.Leaderboard;
import com.openfeint.api.resource.Score;
import com.openfeint.api.ui.Dashboard;
import com.openfeint.internal.OpenFeintInternal;

//
// Game Feed Stuff
import com.openfeint.gamefeed.GameFeedSettings;
import com.openfeint.gamefeed.GameFeedView;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import android.widget.Toast; // Used for presenting diagnostic messages.



Xaron(Posted 2012) [#59]
Ok, got one problem solved.

My problem was that in the project.properties from Monkey the android target is set to 13 BUT the OpenFeint project.properties target is set to 3.

So I set the project.properties of OpenFeint to 13 as well so that it looks like:

# Project target.
target=android-13


This has to be done for both OpenFeint/GameFeed/project.properties and OpenFeint/OpenFeintAPI/project.properties.

As I've installed the complete Android SDK (including target 3 and 13) there might be some issues with mixed targets which probably don't pop up if you have only one target installed.


Xaron(Posted 2012) [#60]
Compile error again...

package ;


I don't know... AAAAAAAH. Will try a fresh clean install of everything.


Xaron(Posted 2012) [#61]
Rich, can you please tell me which Android SDK (targets) you have installed and what JDK version? Thanks.


Xaron(Posted 2012) [#62]
Looks like something goes wrong with the package creation.

Usually you have something like project/test.build/android/src/com/monkey/MonkeyGame.java

The first lines in MonkeyGame.java should look like:
//${PACKAGE_BEGIN}
package com.monkey;
//${PACKAGE_END}


BUT, my folder structure for the Openfeint test look like project/test.build/android/src/MonkeyGame.java

with:
//${PACKAGE_BEGIN}
package ;
//${PACKAGE_END}


It's clear that the APP_PACKAGE variable don't make it into the final build due to reasons beyond my imagination. Did a clear install of everything beside the Android SDK itself.


Xaron(Posted 2012) [#63]
Rich, would you be so kind to test this small project on your side? No need to run it but does it compile?

http://www.xaron.net/dl/monkey/oftest.zip

Thanks!


pantson(Posted 2012) [#64]
good news is that it compiled fine...
so it must be something in your set up.


Xaron(Posted 2012) [#65]
Thanks for letting me know. Have you used Monkey 52f?


pantson(Posted 2012) [#66]
work in v51

in v52f I get this error..
-setup:
     [echo] Gathering info for MonkeyGame...
    [setup] Android SDK Tools Revision 15
    [setup] Project Target: Android 3.2
    [setup] API level: 13
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] D:\dev\of2\of.build\android: ../../../OpenFeint/OpenFeintAPI/  => D:\dev\OpenFeint\OpenFeintAPI\
    [setup] D:\dev\of2\of.build\android: ../../../OpenFeint/GameFeed/  => D:\dev\OpenFeint\GameFeed\
    [setup] D:\dev\OpenFeint\GameFeed\: ../OpenFeintAPI => D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] Ordered libraries:
    [setup] D:\dev\OpenFeint\OpenFeintAPI\
    [setup] D:\dev\OpenFeint\GameFeed\
    [setup] D:\dev\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] 
BUILD FAILED
d:\dev\bin\android-sdk\tools\ant\build.xml:421: Application package '' must have a minimum of 2 segments.
Total time: 0 seconds
TRANS FAILED: Android build failed.



Xaron(Posted 2012) [#67]
Thanks Rich, will try it with V51 and later with the brand new V53. I guess V53 won't work as well because of this new introduced config stuff. I'll check this out and contact Mark about this issue.


Xaron(Posted 2012) [#68]
Yep, get the same error with V53:

-setup:
     [echo] Gathering info for MonkeyGame...
    [setup] Android SDK Tools Revision 16
    [setup] Project Target: Android 3.2
    [setup] API level: 13
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] D:\Projekte\oftest\of.build\android: ../../../OpenFeint/OpenFeintAPI/  => D:\Projekte\OpenFeint\OpenFeintAPI\
    [setup] D:\Projekte\oftest\of.build\android: ../../../OpenFeint/GameFeed/  => D:\Projekte\OpenFeint\GameFeed\
    [setup] D:\Projekte\OpenFeint\GameFeed\: ../OpenFeintAPI => D:\Projekte\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] Ordered libraries:
    [setup] D:\Projekte\OpenFeint\OpenFeintAPI\
ERROR:
BUILD FAILED
D:\Programme\Android\android-sdk\tools\ant\build.xml:440: Application package '' must have a minimum of 2 segments.

Total time: 0 seconds    [setup] D:Projekte\OpenFeint\GameFeed\
    [setup] D:\Projekte\OpenFeint\OpenFeintAPI
    [setup] ------------------
    [setup] 



Xaron(Posted 2012) [#69]
Ok, nailed it down.

Looks like the app variables from Monkey don't make it into the manifest.

This is how my manifest looks like after compiling (and before applying your script which doesn't have an effect on the manifest at all):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package=""
	android:versionCode="7"
	android:versionName="1.0.6"
	android:installLocation="auto">

...

	<application android:label="" android:icon="@drawable/icon">
		<activity 
			android:name="MonkeyGame" 
			android:label=""
			android:screenOrientation=""
			android:configChanges="keyboardHidden|orientation"
...

</manifest> 


I just copied the relevant parts.

Look at: package="" and android:screenOrientation=""

Both had Monkey variables in namely ${APP_PACKAGE} and ${SCREEN_ORIENTATION}

If you replace them in your monkey/targets manifest everything should work. Don't know what goes wrong here...


ARRRRRRR... my fault. Mark has change the names. LOL

Should be: ${ANDROID_APP_PACKAGE} and ${ANDROID_SCREEN_ORIENTATION}


Xaron(Posted 2012) [#70]
It works, it works, with V53! YAY! Thanks Rich for your help!

So this is how the AndroidManifest should look like:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="${ANDROID_APP_PACKAGE}"
  android:versionCode="7"
  android:versionName="1.0.6"
  android:installLocation="auto">
  <supports-screens android:resizeable="false"
                    android:smallScreens="true"
                    android:normalScreens="true"
                    android:largeScreens="true"
                    android:anyDensity="true" />

  <uses-sdk 
    android:minSdkVersion="3"
    android:targetSdkVersion="7" />

  <uses-feature android:glEsVersion="0x00010001" />
  <application android:label="${ANDROID_APP_LABEL}" android:icon="@drawable/icon">
    <activity 
      android:name="MonkeyGame" 
      android:label="${ANDROID_APP_LABEL}"
      android:screenOrientation="${ANDROID_SCREEN_ORIENTATION}"
      android:configChanges="keyboardHidden|orientation"
      android:theme=\"@...;
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <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"/>
  </application>
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> 



Difference(Posted 2012) [#71]
Very interesting.

Have you looked into turn-based multiplayer for OpenFeint? It seems they have taken it down from their site.

Are any of you thinking about making an iOS version?


Xaron(Posted 2012) [#72]
Yep, I'll do an iOS version.


Difference(Posted 2012) [#73]
Yep, I'll do an iOS version.

Super!


MonkeyPig(Posted 2012) [#74]
Pantson,

I've not messed with any of this OpenFeint stuff for months as I was busy doing some other projects. I've also been missing around with an Android project (in Monkey - with bits of Native UI) and I found the manifest and the playing with layout stuff to be a major PITA whenever I was trying to do a clean build. Unless I'm missing something obvious the Android build process is kinda broken when you start trying to integrate with Layouts and various other Resources.

Did you get the GamerFeed stuff working?


pantson(Posted 2012) [#75]
@MonkeyPig
Yeah I did get it working. I had to play with your code and my main.xml..
        public static void GameFeed()
	{
                System.out.println("GAMEFEED->getIntent()");
                Intent i = MonkeyGame.activity.getIntent();


                // Alignment:
                boolean top = i.getBooleanExtra("com.openfeint.example.GameFeedPage.top", false);
                //gameFeedSettings.put(GameFeedSettings.Alignment, (top ? GameFeedSettings.AlignmentType.TOP : GameFeedSettings.AlignmentType.BOTTOM));
                gameFeedSettings.put(GameFeedSettings.Alignment, GameFeedSettings.AlignmentType.TOP);

                // Animation:
                boolean animated = i.getBooleanExtra("com.openfeint.example.GameFeedPage.animated", false);
                gameFeedSettings.put(GameFeedSettings.AnimateIn, animated);

                // Custom assets:
                boolean custom = false; //i.getBooleanExtra("com.openfeint.example.GameFeedPage.custom", false);

                System.out.println("GAMEFEED->gameFeedSettings");
                String layoutType = i.getStringExtra("com.openfeint.example.GameFeedPage.layout_type");

                 System.out.println("GAMEFEED->setContentView");

                gameFeedView = new GameFeedView(MonkeyGame.activity, gameFeedSettings);
                System.out.println("gameFeedView="+gameFeedView);

                int layoutId;
                layoutId = R.layout.main;
                //layoutId = R.layout.gamefeed_layout_linear;
                //layoutId = R.layout.gamefeed_monkey;
 //               MonkeyGame.activity.setContentView(layoutId);

//View  monkeyView = null;

// FIND VIEW from main.xml- pantson
                View monkeyView = MonkeyGame.activity.findViewById( R.id.gamefeedView );
                System.out.println("monkeyView="+monkeyView);

                if (monkeyView!=null)
                {
                    gameFeedView.addToLayout( monkeyView );
                    System.out.println("GAMEFEED->addToLayout");
                }

                // TODO: Need to figure out how to get at the savedInstanceState from MonkeyGame...
                //visible = (MonkeyGame.savedInstanceState != null) ? MonkeyGame.savedInstanceState.getBoolean(FEED_VISIBLE, true) : true;
                visible=true;
                //gameFeedView.show();
                System.out.println("GAMEFEED->show");

                System.out.println("GAMEFEED->complete");
        }


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:orientation="vertical" >

	<view class="${APP_PACKAGE}.MonkeyGame$MonkeyView"
    		android:id="@+id/monkeyview"
		android:keepScreenOn="true"
  		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		/>


		<LinearLayout
			android:layout_width="fill_parent"
			android:layout_height="76px"
			android:orientation="vertical"
		 	android:id="@+id/gamefeedView">
		</LinearLayout>

</RelativeLayout>


I hope that helps...


pantson(Posted 2012) [#76]
Xaron.. great work!
I'll look forward to an iOS version too


pantson(Posted 2012) [#77]

I've not messed with any of this OpenFeint stuff for months as I was busy doing some other projects. I've also been missing around with an Android project (in Monkey - with bits of Native UI) and I found the manifest and the playing with layout stuff to be a major PITA whenever I was trying to do a clean build. Unless I'm missing something obvious the Android build process is kinda broken when you start trying to integrate with Layouts and various other Resources.


yeah.. Monkey IMO isn't designed for Native UI stuff. Its great at creating one view and then processing all gfx in that view acting like a portal for monkey. Once you start to add buttons and views using native UI to cater for external libs it all gets very complicated.

I'm currently writing a movie module for Monkey and finding it very difficult to get consistent results as views are hidden behind each other.


MonkeyPig(Posted 2012) [#78]
I managed to get quite a bit of the Android GUI going on top of the MonkeyView - nothing complicated just buttons, images, textviews and editviews. Switched to a RelativeLayout and switch UI elements on/off as I need them to simulate multiple layouts. Ideally these would be individual Layouts but I didn't get that working in the time I had allotted. Getting Monkey to talk balk & forth was surprisingly straightforward.

Good luck with the Movie Module.


Aman(Posted 2012) [#79]
Did anyone manage to make a module out of this yet?

I want to try getting OpenFeint to work with my games but this is really hard to follow. Could anyone give a clear direction of the steps please? :)


MonkeyPig(Posted 2012) [#80]
It's trivial to make a module out of the Monkey side of things. Unfortunately - there's no easy way to add the libraries and edit the manifest. As far as I'm aware you need to edit all of the files manually and also follow the OpenFeint installation instructions too.

Also - as far as I'm aware - there is no way to make Monkey install all of the OpenFeint resource files either. You need to manually copy them.

Of course - it's been months since I looked at this. Pantson or someone else may have come up with a better solution by now and the latest versions of Monkey do have some extra config options that may help.


pantson(Posted 2012) [#81]
MonkeyPig is right... the module itself is quite simple, but it doens't prep the project for you..

- Tell Ant about the lib
- Alter the main.xml
- Alter the AndroidManifest.xml

The above has to be done manually but only once for each project. I'm unaware of anything in the new version to do this for you...


Aman(Posted 2012) [#82]
Thanks, I will give it a try once I get my new phone.