Java Code Examples for com.google.android.gms.games.multiplayer.realtime.Room#getRoomId()

The following examples show how to use com.google.android.gms.games.multiplayer.realtime.Room#getRoomId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealTimeMultiplayer.java    From godot-gpgs with MIT License 6 votes vote down vote up
@Override
public void onConnectedToRoom(Room room) {
    Log.d(TAG, "onConnectedToRoom.");

    //get participants and my ID:
    participants = room.getParticipants();
    myId = room.getParticipantId(Games.Players.getCurrentPlayerId(googleApiClient));

     // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
     if (roomId == null) roomId = room.getRoomId();

    // print out the list of participants (for debug purposes)
    Log.d(TAG, "Room ID: " + roomId);
    Log.d(TAG, "My ID " + myId);
    Log.d(TAG, "<< CONNECTED TO ROOM>>");
}
 
Example 2
Source File: MainActivity.java    From android-basic-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnectedToRoom(Room room) {
  Log.d(TAG, "onConnectedToRoom.");

  //get participants and my ID:
  mParticipants = room.getParticipants();
  mMyId = room.getParticipantId(mPlayerId);

  // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
  if (mRoomId == null) {
    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>>");
}
 
Example 3
Source File: RealTimeMultiplayer.java    From godot-gpgs with MIT License 5 votes vote down vote up
@Override
public void onRoomCreated(int statusCode, Room room) {
    Log.d(TAG, "onRoomCreated(" + statusCode + ", " + room + ")");
    if (statusCode != GamesStatusCodes.STATUS_OK) {
        Log.e(TAG, "*** Error: onRoomCreated, status " + statusCode);
        showGameError();
        return;
    }

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

    // show the waiting room UI
    showWaitingRoom(room);
}
 
Example 4
Source File: MainActivity.java    From android-basic-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onRoomCreated(int statusCode, Room room) {
  Log.d(TAG, "onRoomCreated(" + statusCode + ", " + room + ")");
  if (statusCode != GamesCallbackStatusCodes.OK) {
    Log.e(TAG, "*** Error: onRoomCreated, status " + statusCode);
    showGameError();
    return;
  }

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

  // show the waiting room UI
  showWaitingRoom(room);
}