Reliably store webpage offline in Android
My app has a 'pin' button like the Google Docs app:
Part of storing an item offline in my app is to store a complete webpage
including associated javascript and css.
Now, there are mutiple roads I can take, but I have difficulty judging
which will work. Here are the options I am considering:
The associated website already makes use of HTML5 caching (e.g., has a
manifest file which says which files should be cached), and this seems to
work fine. I could load in the web page in an invisible WebView so that it
will get cached.
Use WebView.saveWebArchive() on an invisible WebView and then load it
again when needed. This requires at least API level 11.
Store the HTML, javascript and CSS files through 'old school' means, e.g.,
get the input streams from the URL and store them in some folder.
As it looks now, option 1 is my preferred route. But what I am fretting
about is that the cache might be cleared on low memory. Is this, indeed,
the case?
No comments:
Post a Comment