Arpan24x7
Arpan24x7

Reputation: 668

Httpurlconnection with samsung s5

I found an issue in Samsung S5 with using HTTPURLCONNECTION may be I'm doing wrong but if any one have an idea kindly guide me.

Here is my code :

URL urls = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urls.openConnection();

connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("x-os-application-token", Constants.APPLICATION_TOKEN);

connection.setConnectTimeout(900000);
connection.setReadTimeout(150000);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);


DataOutputStream wr = new DataOutputStream(
        connection.getOutputStream());
wr.writeBytes(json);
wr.flush();
wr.close();


int responseCode = connection.getResponseCode();

Now using this code if I manually Internet disconnect (WI_FI OFF) then other device (e.g. Nexus 5 and Samsung Galaxy Note 3) give me response immediate but In Samsung S5 it respond me after connection.setReadTimeout(150000) ??? 2.5 minutes

Upvotes: 0

Views: 203

Answers (0)

Related Questions