I am running a service in my android application (2.3.4) that is uploading results from a database to an online server. I am doing the uploading in a thread inside the service.
The problem I am having is that when the screen goes to sleep, the connection seems to stop and the upload is paused until the next time I turn on the screen. I’m not sure if the problem is in the thread, the service or the internet connection. One of these seems to get paused to cause this issue. Has this happened to anyone else, do you know what is causing it and how to overcome this?
Appreciate the help, thanks.
Are using connecting via WiFi? In the WiFi settings you can specify if the WiFi is dropped when screen locks. It’s meant to save battery when device is not used. Also, make sure your app is able to reconnect when the Internet connection changes from WiFi to mobile. If you have a socket connection open, it obviously drops when changing and you need to reconnect.