views:

91

answers:

1

As described in this answer you cannot grab a progress of a multipart/form POST upload in Android using only the Android SDK, because there is an issue with the stream buffering when using HttpURLConnection which will be fixed post Froyo (see http://code.google.com/p/android/issues/detail?id=3164#c6).

Since the Apache HttpClient 3.1 was removed from the SDK quite early and the new HttpClient, which is now part of the SDK, wasn't adopted completely (it misses multipart capabilities) you can add the missing parts (specifically apache-mime4j-0.6.jar and httpmime-4.0.1.jar) to perform a multipart/form-data upload AND grab the progress of the upload (also described in the answer mentioned above).

Now, the reason why I open a new question is, that doing as described leads to an enormous growth of the installed app size (in my case from 170kb to 732kb).

So, the question is: Is there any other way to perform a multipart/form-data upload and grab the upload progress without increasing the app size that much? Are there any other libraries one can use or is there any other alternative way, not mentioned here?

A: 

A totally alternative way. This is probably only worth the trouble if your upload takes long, because it will have a certain latency and you cannot update the progress more often than ~1x per second.

Anyways, here's my idea: You could track the upload Progress on the Server Side (for example using PHP and APC).

In android, you could start a separate device that frequently polls the upload status via HTTP and updates the UI.

There are some drawbacks to this solution. Here's what I can think of right now:

  • Complex to implement (separate Thread, additional HTTP-Connection, ..)
  • You need also to be in control of the server side and make changes there.
  • You create additional internet-traffic during your upload which could slow down your upload and consume more of the users free megabytes.
pableu
In my case, unfortunately, I cannot control the server side in any way.
Manuel
Well, then this obviously won't work. I'm sorry.
pableu