Skip to content

Most visited

Recently visited


Optimizing General Network Use

In general, reducing the amount of network traffic helps reduce battery drain. In addition to the battery-optimization techniques of the previous lessons, you should look at these general-purpose techniques and see if you can apply them to your app.

This lesson briefly covers techniques that you can use to lower network traffic and consequently reduce the battery drain caused by your app.

Compress Data

Reducing the amount of data sent or received over a network connection also reduces the duration of the connection, which conserves battery. You can:

Cache Files Locally

Your app can avoid downloading duplicate data by caching. Always cache static resources, including on-demand downloads such as full size images, and cache them for as long as reasonably possible.

For example, you should consider this approach for a networked app that displays data from user-initiated network requests as the primary content on the screen. When the user opens this screen the first time, the app should display a splash screen. Subsequent loads should initially load with the data that was cached from the last network request. The screen reloads with new data once the network request is complete.

To learn about caching, watch the video. To implement caching in your app, see Cache Files Locally.

Optimize Pre-Fetch Cache Size

Optimize pre-fetch cache size based on local file system size and current network connectivity. You can use the connectivity manager to determine what type of networks (Wi-FI, LTE, HSPAP, EDGE, GPRS) are active and modify your pre-fetching routines to minimize battery load.

For more information, see Use Modifying your Download Patterns Based on the Connectivity Type.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)