Phone stops exit code when screen is turned off

tvaltval Member ✭✭

I have a TCP connection between the phone and my server. When the user presses the power button to turn off the screen, the exit code to disconnect from the server stops executing. As a result, the server never receive the "exit" packet. I have the code to disconnect from the server on the OnPause event, but about half the time it fails to execute. Is there a way of preventing the code from stopping its execution? Or is there another place where I can put the disconnect code besides OnPause where it will hopefully fully execture before the phone shuts down?

Sign In or Register to comment.