Search code examples
androidandroid-gps

How can i leave a room when my game is finnished - Google Play Services - Android


I've successfully integrated GPS realtime multiplayer into my game & it's working good.

Though. When a game is finished, players stays connected to each other..

How can i disconnect a player manually from the game?

So when the game is finished, the player will disconnect from the room by pressing for example "back to menu".

/ Martin


Solution

  • I just solved by checking if room is active.

    if (mRoomID != null) {
        Games.RealTimeMultiplayer.leave(getApiClient(), this, mRoomID);
        mRoomID = null;
    
    }