From 18767eb89f600d03a810a888c1ac9283fd787de5 Mon Sep 17 00:00:00 2001 From: Ali Sarrafi Date: Wed, 23 May 2012 11:15:48 +0200 Subject: [PATCH] [MOSYNC-2188] fixed the ICS networking issue. --- .../internal/android/MoSyncNetwork.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/MoSyncNetwork.java b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/MoSyncNetwork.java index 21adaa962..03e10441c 100644 --- a/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/MoSyncNetwork.java +++ b/runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/internal/android/MoSyncNetwork.java @@ -72,6 +72,7 @@ import android.bluetooth.BluetoothServerSocket; import android.bluetooth.BluetoothSocket; import android.net.SSLCertificateSocketFactory; +import android.os.Build; import android.os.Looper; import android.util.Log; @@ -1128,8 +1129,14 @@ public ConnectionObject create(String url, int handle) mUrlConnection = new URL(url).openConnection(); mUrlConnection.setAllowUserInteraction(true); - mUrlConnection.setDoInput(true); - mUrlConnection.setDoOutput(true); + // The number is hardcoded here for ICS but we have to change it to + // its actual constant after upgrading the our Android SDK + if(Build.VERSION.SDK_INT < 14) + { + mUrlConnection.setDoInput(true); + mUrlConnection.setDoOutput(true); + } + mUrlConnection.setUseCaches(false); return this; @@ -1146,8 +1153,13 @@ public ConnectionObject createHttp(String url, int method, int handle) mUrlConnection = new URL(url).openConnection(); mUrlConnection.setAllowUserInteraction(true); - mUrlConnection.setDoInput(true); - mUrlConnection.setDoOutput(true); + // The number is hardcoded here for ICS but we have to change it to + // its actual constant after upgrading the our Android SDK + if(Build.VERSION.SDK_INT < 14) + { + mUrlConnection.setDoInput(true); + mUrlConnection.setDoOutput(true); + } mUrlConnection.setUseCaches(false); HttpURLConnection httpConnection =