Very slow Httpurlconnection implementation when running

Asked

Viewed 120 times

2

I’m using the class HttpURLConnection to make the connection to a site that returns a JSON and I did the following encoding:

URL url = new URL("http://hmkcode.appspot.com/rest/controller/get.json");

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();

When executing the methods url.openConnection() and connection.connect() the system takes a long time to respond. I even have the desired feedback, but it takes about 5 minutes to execute the methods. Why is this happening? Remembering that I am doing everything within the method doInBackground of a AsyncTask

  • 3

    Shows your Asynctask. Some other routine may be slow, not connection act. (debugged?)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.