A
A
Alexander Vasyuchenko2015-08-28 11:25:09
Android
Alexander Vasyuchenko, 2015-08-28 11:25:09

How to avoid "Connection timed out" when device screen goes blank?

Implemented a download manager based on HttpURLConnection in the program. Everything shakes, but the problem is the screen going out. On some devices it throws an error in this case:
java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)
What are the ways to solve this problem? Make the screen not turn off during the download or are there any other solutions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Bolshakov, 2015-08-28
@alexv1981

The device goes into suspend and tries to "lull" everything superfluous, including the network.
Android has a mechanism called "partial wakelock".
Keeping the Device Awake
WakeLock
WakefulBroadcastReceiver
DownloadManager

O
onlooked, 2015-08-28
@onlooked

there are applications that do not allow the processor to sleep (more precisely, they switch it to the hard mode). look on the Internet for such programs. one of them is in the market, called device ( https://play.google.com/store/apps/details?id=org.... There you need to change the mode of the processor (how to do this and what they are can be found in web)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question