Improved options than backporting ICS HttpResponseCache

I need to cache HTTP responses and based on this blog post that functionality is built into ICS. However, I need to support version 1.6 and higher, so I would like to see if there are libraries ready for use before looking at the need to back up ICS functions.

Update:

Here's a link to the HttpResponseCache , which only supports java.net.HttpURLConnection .

Second update:

After some research, it looks like Apache HttpClient supports caching with the caveat that the default backend (in memory) is probably not a good idea for Android applications with limited memory. Ehcache might be a good option depending on Android support.

+8
android caching
source share
2 answers

I created this problem with a request to add a renamed backward compatible version of android.net.http.HttpResponseCache to the compatibility library: https://code.google.com/p/android/issues/detail?id=23875

Google rejected this issue, but offered to help me create a backport and library. Therefore, I am trying to do this.

In addition, HttpClient-Cache may be neat to use. It does not work on Android, as it is, you need to make a small modification and recompile it. See http://comments.gmane.org/gmane.comp.apache.httpclient.user/501

However, I would recommend that you try https://code.google.com/p/httpclientandroidlib/ - this is a repackaged (renamed) version of HttpClient and HttpClient-Cache for Android. It's pretty simple to set up (just turn on the jar and then use ch.boye.httpclientandroidlib. * Instead of org.apache.http. *).

+11
source

I started using a library that candrews supported backported, and I am pleased to report that it works well, as a replacement for replacement for pre-ICS Android applications using HttpUrlConnection. It is available at https://github.com/candrews/HttpResponseCache

Another nice thing: the API is the same as the ICS version, so you can enable the built-in ICS and use the preliminary ICS with a preinstalled version of candrews with very little code.

+7
source

All Articles