playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
972 stars 970 forks source link

Multiplayer Room created gives a null ID #157

Open Naireen opened 9 years ago

Naireen commented 9 years ago

I downloaded this code to help me learn how to do real time multiplayer games, however, I ran into some issues with it. The quick game option works, but when I try to invite players, the game room isn't created properly. I get a java run time error saying that the room ID must not be null. Two errors are thrown are

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=10002, result=-1, data=Intent { (has extras) }} to activity {ml.digits/ml.digits.MultiPlayerSignIn}: java.lang.IllegalStateException: Room ID must not be null or empty

java.lang.IllegalStateException: Room ID must not be null or empty.

The three methods causing the error are broadcastScore, startGame and onActivityResult. Any help will be greatly appreciated!

gjohnrao commented 9 years ago

I am stuck with the same issue...

gjohnrao commented 9 years ago

it's been resolved bro...!

gjohnrao commented 9 years ago

@Override public void onConnectedToRoom(Room room) { Log.d(TAG, "onConnectedToRoom.");

    //get participants and my ID:
    mParticipants = room.getParticipants();
    mMyId = room.getParticipantId(Games.Players.getCurrentPlayerId(mGoogleApiClient));

    // save room ID so we can leave cleanly before the game starts.
    mRoomId = room.getRoomId();

    // print out the list of participants (for debug purposes)
    Log.d(TAG, "Room ID: " + mRoomId);
    Log.d(TAG, "My ID " + mMyId);
    Log.d(TAG, "<< CONNECTED TO ROOM>>");
}

It may be under review so here is the code.!

AreamierAmier commented 3 years ago

Same issue