android-basic-samples icon indicating copy to clipboard operation
android-basic-samples copied to clipboard

Multiplayer Room created gives a null ID

Open Naireen opened this issue 9 years ago • 4 comments

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!

Naireen avatar Sep 01 '15 00:09 Naireen

I am stuck with the same issue...

gjohnrao avatar Oct 16 '15 13:10 gjohnrao

it's been resolved bro...!

gjohnrao avatar Oct 16 '15 14:10 gjohnrao

@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.!

gjohnrao avatar Oct 16 '15 14:10 gjohnrao

Same issue

AreamierAmier avatar Jul 18 '21 19:07 AreamierAmier