Android run in background

Options
Hello,
I am developing multiplayer card game.At this time players connect and play game properly,but i have issue : when any player hit home button in android and player go to background - after that disconnect due to time out.
So,how to rejoin the player at same room,when back to the game.

I am trying this method to rejoin but not join.
PhotonNetwork.JoinRoom (roomName,actorId);

I saw many of the thread but cant understand..please help me
Thanks in advance.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2016
    Options
    Hi @UnityGames,

    To be able to rejoin you need to set PlayerTTL to a number of milliseconds you want to wait for the player to return to the game after he/she gets disconnected. I think 12000ms is enough. This will not take into consideration the timeout which is 10 seconds IIRC. So the player can return after background thread timeout + connection timeout + PlayerTTL.

    Take a look at this discussion to make use of background thread in PUN.

    To rejoin, we recommend setting CheckUserOnJoin = true when creating rooms then call PhotonNetwork.JoinRoom (roomName, -1);. The UserID will be used in the rejoin to get same actor number.
  • UnityGames
    edited April 2016
    Options
    Hello,
    I am trying your way background thread time out and connection time out.
    and for Rejoin RoomOptions.CheckUserOnJoin = true passed this also.
    After DisconnectByServer,timeOut,Again i am join master server and connect room with store ActorId,But give me this error :
    Operation failed: OperationResponse 226: ReturnCode: 32748 (Actor with number 2 not found.). Parameters: {} Server: GameServer.
    Please help me for manage timeout and disconnect by server,etc
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    What's the PlayerTTL? Do you explicitly disconnect players, if so, what code do you use?
  • UnityGames
    Options
    Hi,
    PlayerTtl = 12000.
    In my android device i pressed home button and after 10-12 secs again come to game screen,that time OnStatusChanged -> DisconnectByServer status passed to me,after that i am trying to connect first photon server and after that room...