What should be the standard connection timeout and socket timeout in android

I used Rest calls in my application using HttpClient. I see that with a slow connection, my requests remain in a state of execution for a long time. And I want to cancel HTTP requests if it takes a long time. So, what should be the standard ConnectionTimeout and socket timeout in an Android application if json data is retrieved from a java server.

+4
source share
1 answer

It depends less on the platform (Android) than on the use case. If your user needs a response from the request to continue working, you may need more time, if it is just a background update, you may have less time, even if in this case the user may not realize that he is waiting for something.

The main thing is that the user is informed that you are still doing something in the background and should be able to cancel the task if it takes too much time. Unimportant background updates that he probably doesn't want to see at all.

One of the best IME implementations is Amazon, which updates the interface after a few seconds, stating that the request takes longer. If the request has not yet been completed, you will be asked to try again later, and you can always cancel and return.

+2
source

All Articles