I’m writing an application which at start up posts a message to the server and waits for the response. To achieve this I’m using DefaultHttpClient.execute method with response time set to default. The whole operation is triggered as a separate thread which is set as a daemon thread, because I don’t want for the application to be blocked when user decide to close it too fast (while still waiting for the server response). Still, when I try to kill an application through android.os.Process.killProcess call there is a significant delay, which I’m guessing is related with DefaultHttpClient.execute mechanism (not-daemon thread execution?). Is there a way to kill my connection just after killProcess call?
Share
ANSWER: Found perfect solution at (usage of AsyncTask combined with HttpPost.abort call):
How to cancel DefaulHttpClient execution process in multithread