我有一个奇怪的情况。使用电话和虚拟设备时,所有请求都能正常工作,但如果我尝试使用Tablet,则无效。使用平板电脑无法获得urlConnection.getInputStream()
我的要求:
String path = "https://...";
HttpURLConnection urlConnection = null;
try{
URL url = new URL(path);
urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection = Tools.setHeader(urlConnection);
urlConnection.setDoInput(true);
LOG.debug("Start input stream");
InputStream inputStream = urlConnection.getInputStream();
LOG.debug("Input stream exist "+inputStream.toString());
String response = Tools.streamToString(inputStream);
inputStream.close();
JSONObject jsonResponse = new JSONObject(response);
我没有得到任何错误消息。使用代理服务器,我看到我的请求发送和收到的响应。但在程序urlConnection.getInputStream()
方法中什么都没有。该计划不会进一步。我没有看到第二个日志。
我试图设置超时,但这没有帮助。反应很快(1-2秒)。
我使用的真正平板电脑的Android 5.1版本。 1 – Delphian
你能分享一下吗? ou正在使用的“URL”,soo,我们可以检查 –
我不能抱歉。但是我测试了不同的网址并获得了相同的结果。 – Delphian