Running HttpClient HttpPost is significantly slower on Android 3.2 than 2.3.3

Does anyone know why the code below will run about 4 times slower on Android 3.2 (Samsung Galaxy Tab 10.1) than on 2.3.3 (Motorola Droid X)?

In Android 2.3.3, calling client.execute () takes an average of 350 ms . In section 3.2, it takes an average of 1400 ms .

In addition, the results are the same regardless of whether it is running in a user interface thread or in a background thread.

Is this an OS error or a hardware problem? Or am I not doing something in my code? Unfortunately, I cannot connect ADB to my 3.2-virtual device, so I cannot rule out hardware problems, but my gut feeling tells me that this is a cellular problem.

HttpResponse resp = null; HttpParams params = new BasicHttpParams(); params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpClient client = new DefaultHttpClient(params); ArrayList<BasicNameValuePair> postParms = new ArrayList<BasicNameValuePair>(); postParms.add(new BasicNameValuePair("name", "test")) try { HttpPost hp = new HttpPost("http://myserver/path/method"); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParms); hp.setEntity(formEntity); Long start = SystemClock.elapsedRealtime(); resp = client.execute(hp); Long stop = SystemClock.elapsedRealtime(); Log.i("Time = " + (stop-start) + "ms"); } ... 
+6
source share
1 answer

If you do not synchronize anything, install a terminal and look at the top on the Galaxy tab to make sure that the processor is not consumed, for example. android.process.media.

0
source

Source: https://habr.com/ru/post/907718/


All Articles