From 41cddd197bbd787724b66653756aabdad64cb63e Mon Sep 17 00:00:00 2001 From: Ricardo Cervera Date: Wed, 20 Aug 2014 15:42:29 -0700 Subject: [PATCH] docs: Fixed minor bug in downloads class. Bug: 16948533 Change-Id: Id434c2a85b875dc5bcb5e5ebeec2e412494d6cbe --- .../training/efficient-downloads/redundant_redundant.jd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/html/training/efficient-downloads/redundant_redundant.jd b/docs/html/training/efficient-downloads/redundant_redundant.jd index 4bf9af9df50df..674298a050e05 100644 --- a/docs/html/training/efficient-downloads/redundant_redundant.jd +++ b/docs/html/training/efficient-downloads/redundant_redundant.jd @@ -30,8 +30,8 @@ next.link=connectivity_patterns.html

The most fundamental way to reduce your downloads is to download only what you need. In terms of data, that means implementing REST APIs that allow you to specify query criteria that limit the returned data by using parameters such as the time of your last update.

Similarly, when downloading images, it's good practice to reduce the size of the images server-side, rather than downloading full-sized images that are reduced on the client.

- -

Cache Files Locally

+ +

Cache Files Locally

Another important technique is to avoid downloading duplicate data. You can do this by aggressive caching. Always cache static resources, including on-demand downloads such as full size images, for as long as reasonably possible. On-demand resources should be stored separately to enable you to regularly flush your on-demand cache to manage its size.

@@ -60,11 +60,11 @@ if (lastModified < lastUpdateTime) {

Alternatively, you can use the managed / secure application cache. Note that this internal cache may be flushed when the system is running low on available storage.

-
Context.getCache();
+
Context.getCacheDir();

Files stored in either cache location will be erased when the application is uninstalled.

-

Use the HttpURLConnection Response Cache

+

Use the HttpURLConnection Response Cache

Android 4.0 added a response cache to {@code HttpURLConnection}. You can enable HTTP response caching on supported devices using reflection as follows: