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.
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.
0
Answers
-
Hi @UnityGames,
To be able to rejoin you need to setPlayerTTL
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 afterbackground thread timeout + connection timeout + PlayerTTL
.
Take a look at this discussion to make use of background thread in PUN.
To rejoin, we recommend settingCheckUserOnJoin = true
when creating rooms then callPhotonNetwork.JoinRoom (roomName, -1);
. TheUserID
will be used in the rejoin to get same actor number.0 -
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,etc0 -
What's the
PlayerTTL
? Do you explicitly disconnect players, if so, what code do you use?0 -
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...0