Build and run the OpenFeint Sample Application

The sample app lets you experiment with the features youve configured on the OpenFeint dev dashboard before youve begun to write your own app. Once you do begin working with your own app, it is frequently helpful to come back to the sample app to see how individual features work and how they can best be implemented.

i love free samples application Save the Contents of the OpenFeint Android SDK package in a convenient location. Everything you need from this package to build the sample app is in the directory called MyOpenFeintSample. You may copy this directory out of the package and rename it if you want to use it as a starting point for experimental code.

To develop in Eclipse: Open Eclipse with an empty workspace. This will present an empty Project Explorer pane to which you will add a reference to the sample app project. Make sure that the path to your Android SDK has been set for this workspace. To set it:

  • On a Mac, go to: Eclipse>Preferences>Android>SDK Location.
  • On Windows, go to: Window>Preferences>Android>SDK Location.
  • Add the sample app project to the workspace:

    Right click in the empty Project Explorer pane and select Import. Select General >Existing Projects into Workspace from the import dialog. Click the Next button. Click Select root directory. Click Browse. Navigate to the MyOpenFeintSample directory in the OpenFeint package. Click Open. Click the Finish button. The MyOpenFeintSample is now listed in the project window.

  • Add your product information to the sample app:
  • Add the OpenFeint SDK project to the workspace:
  • If you see a warning that reads, Android requires .class compatibility set to 5.0. Please fix project properties:
  • Add the Gamefeed project to the workspace:
  • If you see a warning that reads, Android requires .class compatibility set to 5.0. Please fix project properties:
  • Try building the project to confirm that there are no build errors.
  • Some things to try if your project does not build :
  • Depending on your version of Eclipse and the Android tools, you may need to close the MyOpenFeintSample project and re-open it for it to correctly link to the OpenFeintAPI Android Library. The usual symptom for this is a java.lang.NoClassDefFoundError when trying to launch the sample application. If you experience this, right-click on the MyOpenFeintSample folder, select Close Project, then right-click on it again and select Open Project. After rebuilding, the crash should be gone.
  • Run the sample application on an Android device or simulator. You may use a USB cable to attach an Anrdoid device if configured for remote debugging or allow the Android simulator to be used if no device is attached. Click the Run button or select Run from the Run menu. If the Run As dialog appears, select Android Application and click OK.If successful, the sample app displays a list of OpenFeint features that you can test.
  1. Register an application using the OpenFeint developer dashboard.
  2. Download the latest version of the OpenFeint SDK for Android.
  3. Extract the package.
  4. Run android.bat update lib-project –p /sdk/
  5. Add the line android.library.reference.1=FullPathToOpenFeintPackage/sdk/ to the build.properties file of the game.
  6. Create a directory in which to build your sample application.
  7. Copy the entire MyOpenFeintSample directory from the SDK download (It should be in the download/OpenFeint.1.10.2 folder) into the new directory you created.
  8. Open the MyOpenFeintSample/src/com/openfeint/example/OpenFeintApplication.java file and provide your games name, key, secret, and id to OpenFeintSettings.
  9. Copy the entire OpenFeintAPI directory from the download/OpenFeint.1.10.2 folder into the root of the new directory.
  10. In a command window, change directories to the directory into which you placed the MyOpenFeintSample and the OpenFeintAPI.
  11. In the same command window, run:
    android update lib-project -p OpenFeintAPI/
    The following message appears:
     Updated local.properties  Added file OpenFeintAPI/proguard.cfg  	
  12. Change your working directory to the location into which you copied the OpenFeint sample application:
     cd dirContainingMyOpenFeintSample/MyOpenFeintSample  
  13. In the same command window, run:
    android update project -p
    The following message appears:
      Updated local.properties  Added file ././proguard.cfg  		
  14. Now enter:
    ant debug