Downloading Data Without Draining The Battery in Android

The timing and techniques you use to download data can have a significant effect on battery life. The wireless radio on mobile devices draws significant power when active, so it’s important to consider how your application’s connectivity model may impact the operation of the underlying radio hardware

Every time you create a new connection to download additional data, you risk waking the wireless radio from standby mode to active mode. In general, it’s good practice to bundle your connections and associated downloads to perform them concurrently and infrequently

To use a converse example, creating frequent, short-lived connections that download small amounts of data can have the most dramatic impact on the battery

You can use the following techniques to minimize your application’s battery cost

Aggressively prefetch — The more data you download in a single connection, the less frequently the radio will need to be powered up to download more data. This will need to be balanced with downloading too much data that won’t be used

Bundle your connections and downloads — Rather than sending time-insensitive data such as analytics as they’re received, bundle them together and schedule them to transmit concurrently with other connections, such as when refreshing content or prefetching data. Remember, each new connection has the potential of powering up the radio.

Reuse existing connections rather than creating new ones — Using existing connections rather than initiating new ones for each transfer can dramatically improve network performance, reduce latency, and allow the network to intelligently react to congestion and related issues

Schedule repeated downloads as infrequently as possible — It’s good practice to set the default refresh frequency to as low as usability will allow, rather than as fast as possible. For users who require their updates to be more frequent, provide preferences that allow them to sacrifice battery life in exchange for freshness.

Leave a Comment