Going on background or application lose focus , photon discoonect.
Options
Hi,
In my application when i am connected to photon in android , when my application goes in background, photon disconnect.
Note : I haven't joined any room yet.
How can i again connect to photon when open the application from background?
In my application when i am connected to photon in android , when my application goes in background, photon disconnect.
Note : I haven't joined any room yet.
How can i again connect to photon when open the application from background?
0
Comments
-
Hi @Yogesh_Dev,
when the application is active again, Unity will call OnApplicationPause(bool pauseStatus) or OnApplicationFocus(bool hasFocus). You can use this call, to check if application is still connected to Photon. If it is not connected any longer, you can connect to the service again.0 -
Hi @Christian_Simon ,
I am checking this and calling photonNetwork.Reconnect() when pausestatus is false. but unable to reconnect to photon.0 -
Any errors logged to the console or adb?0
-
Hi,
Yes, photonNetwork.icConnectedandReady is always coming false0 -
Instead of using Reconnect, did you already try using another connect function? Is there a different result?
PhotonNetwork.connectedAndReady
is true as soon as the client is connected and ready to exchange operations.0 -
Yes, if i use another connect function instead of reconnect PhotonNetwork.connectedAndReady is always true.0
-
What is the use of Reconnect funtion then?0
-
hi,
One more question, I have created a room. nobody is in the room (except me) then how to destroy room immediately when my internet connection gets off.0 -
Until you don't use another value for
EmptyRoomTtl
(you can set this for example when creating the room by using the RoomOptions), the room gets removed immediately after the last client has left it. If the last client has a timeout, it might take up to 10 seconds before the server 'disconnects' the client and furthermore removes the room.0