Search code examples
androidgoogle-play-servicesmultiplayergoogle-play-games

How to detect if client intentionally left Room in Google Play Games Real-time Multiplayer?


Here is a multiplayer game and I need to display two notifications to player: first when rival disconnected due to some networking problems, and second - when he left game intentionally. Room is created with auto-match criteria (max players - 2). And each time when one of the players left game due to network problems or intentionally RoomStatusUpdateListener callbacks called in the next order: onDisconnectedFromRoom, onPeerLeft, onPeersDisconnected.

So I show notification in onDisconnectedFromRoom callback, the problem is you can't detect if it was network problem that happened to rival or he left intentionally. Participant.getStatus() returns STATUS_JOINED.

So, how to detect if client left room intentionally?

Thank you in advance!


Solution

  • you can send game data between the clients. So just in case a player wants to left the game, send a message that this specific user will disconnect now to all other players.

    best whishes, Steve.