Thursday, May 9, 2013

Uploading a File to AppEngine from Android (without any additional libraries!)

This is going to be a really short post. Recently I had to upload a file from an Android app to an AppEngine server. Most people recommend using third-party libraries, like Apache's HttpClient for that purpose. However, this increases your app's size unnecessarily if you really only want to upload a file to a server. (I think it was an increase of about 1MB). Thankfully, Android already includes (old) parts of Apache's HttpClient, which you can easily use. This won't add anything up to your app's size obviously, because you're using libraries already included in the system.

Here's the code for you: