Frage

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() {});
War es hilfreich?

Lösung

@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  );

}
}

Andere Tipps

If you're not 100% sold on OpenFeint, check out Swarm, which provides a similar set of features (leaderboards, achievements, cloud data save, etc). Swarm's Cloud Data would do exactly what you're looking for, and allow you to save data to a user's account, so no matter what device they're on, they have all of their data available :)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top