Search code examples
androidopenfeint

Get OpenFeint player id on Android


I've integrated OpenFeint into my Android game, and I'm wondering what i need to add in order to get the OpenFeint player id. I want the id or the username so I can allow users to transfer their game accounts between devices, authenticating with OpenFeint.

Here's my code for using OpenFeint:

OpenFeintSettings ofsettings = new OpenFeintSettings(gameName, gameKey, gameSecret, gameID);
OpenFeint.initialize(this, ofsettings, new OpenFeintDelegate() {});

Solution

  • @Andy hi i also needed the player id when i implemented openFeint in the game i developed

    I used the following code

        import com.openfeint.api.OpenFeint;  
            import com.openfeint.api.resource.User;
            import android.app.Activity;
            import android.os.Bundle;
    
      public class ABC extends Activity {
    
    
         User u;
            String Name;
    
    
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.score);
    
    
    
             u = OpenFeint.getCurrentUser();
    
        // user id received 
    
            Name = u.name;
    
        System.out.println("** The User  id is **   "  + Name  );
    
    }
    }