Builder class for RoomConfig
.
Public Method Summary
RoomConfig.Builder | |
RoomConfig.Builder | |
RoomConfig |
build()
Builds a new
RoomConfig object.
|
RoomConfig.Builder | |
RoomConfig.Builder | |
RoomConfig.Builder |
setMessageReceivedListener(RealTimeMessageReceivedListener
listener)
This method is deprecated. use
setOnMessageReceivedListener(OnRealTimeMessageReceivedListener)
instead.
|
RoomConfig.Builder |
setOnMessageReceivedListener(OnRealTimeMessageReceivedListener
listener)
Set the listener for message received from a connected peer in a room.
|
RoomConfig.Builder |
setRoomStatusUpdateCallback(RoomStatusUpdateCallback
callback)
Set the callback for room status changes.
|
RoomConfig.Builder |
setRoomStatusUpdateListener(RoomStatusUpdateListener
listener)
This method is deprecated. use
setRoomStatusUpdateCallback(RoomStatusUpdateCallback) instead.
|
RoomConfig.Builder |
setVariant(int variant)
Sets the variant for the room when calling
create(RoomConfig) .
|
Inherited Method Summary
Public Methods
public RoomConfig.Builder addPlayersToInvite (String... playerIds)
Add one or more player IDs to invite to the room. This should be set only when
calling
create(RoomConfig)
Parameters
playerIds | One or more player IDs to invite to the room. |
---|
Returns
- The builder instance.
public RoomConfig.Builder addPlayersToInvite (ArrayList<String> playerIds)
Add a list of player IDs to invite to the room. This should be set only when calling
create(RoomConfig)
Parameters
playerIds | One or more player IDs to invite to the room. |
---|
Returns
- The builder instance.
public RoomConfig build ()
Builds a new RoomConfig
object.
Returns
- The built
RoomConfig
instance.
public RoomConfig.Builder setAutoMatchCriteria (Bundle autoMatchCriteria)
Sets the auto-match criteria for the room. See
createAutoMatchCriteria(int, int, long)
.
Parameters
autoMatchCriteria | The criteria for auto-matching one or more players for the match. If
null , the match is created with the invited players only. |
---|
Returns
- The builder instance.
public RoomConfig.Builder setInvitationIdToAccept (String invitationId)
Set the ID of the invitation to accept. This is required and should be set only when
calling
join(RoomConfig)
.
Parameters
invitationId | The ID of the invitation to accept. |
---|
public RoomConfig.Builder setMessageReceivedListener (RealTimeMessageReceivedListener listener)
This method is deprecated.
use
setOnMessageReceivedListener(OnRealTimeMessageReceivedListener)
instead.
Set the listener for message received from a connected peer in a room.
If not using socket-based communication, a non-null listener must be provided here
before constructing the RoomConfig
object.
Parameters
listener | The message received listener that is called to notify the client when it receives a message in a room. The listener is called on the main thread. |
---|
public RoomConfig.Builder setOnMessageReceivedListener (OnRealTimeMessageReceivedListener listener)
Set the listener for message received from a connected peer in a room.
If not using socket-based communication, a non-null listener must be provided here
before constructing the RoomConfig
object.
Parameters
listener | The message received listener that is called to notify the client when it receives a message in a room. The listener is called on the main thread. |
---|
public RoomConfig.Builder setRoomStatusUpdateCallback (RoomStatusUpdateCallback callback)
Set the callback for room status changes.
Parameters
callback | The callback that is called to notify the client when the status of the room has changed. The callback is called on the main thread. |
---|
public RoomConfig.Builder setRoomStatusUpdateListener (RoomStatusUpdateListener listener)
This method is deprecated.
use
setRoomStatusUpdateCallback(RoomStatusUpdateCallback)
instead.
Set the listener for room status changes.
Parameters
listener | The listener that is called to notify the client when the status of the room has changed. The listener is called on the main thread. |
---|
public RoomConfig.Builder setVariant (int variant)
Sets the variant for the room when calling
create(RoomConfig)
. This is an optional, developer-controlled parameter
describing the type of game to play, and is used for auto-matching criteria. Must be
either a positive integer or
ROOM_VARIANT_DEFAULT
(the default) if not desired.
Note that variants must match exactly. Thus, if you do not specify a variant, only
other rooms created with
ROOM_VARIANT_DEFAULT
will be considered potential auto-matches.
Parameters
variant | The variant for the match. |
---|
Returns
- The builder instance.