I have Apache 2.4.7 installed on Ubuntu 14.04 LTS. I have been able to connect to the server on OS X, Windows, Linux, and Android 2.3.4. However, when I try to connect to it from Android 4.4.2, it tells me that it cannot establish a connection. The 4.4.2 tablet is connected to the same network as the server, and attempting to connect to the same IP address that has been successfully connected to on other platforms. How can I fix this?
I'm working for hours on this problem but got totally stucked. The following code is running perfectly on my test device with Android 4.1.2, but I can't get it to work with the second device
running 4.4.2. I read moving from
Apache httpClient to
HttpURLConnection solves the problem for some people, but I am also using the
GET-method wich works fine. I already tried to add headers, as mentioned on sites I found. That did not work. So can you please help me in getting this working on Android 4.4.2 or give me a hint to the right direction? Thanks.
List<NameValuePair> params = new ArrayList<NameValuePair>(); . . . DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent();