降低应用程序的电池产生的影响下载超过智能手机的无线内容 [英] Reducing the battery impact of apps that downloads content over a smartphone radio

查看:116
本文介绍了降低应用程序的电池产生的影响下载超过智能手机的无线内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我建立一个智能手机应用程序,从服务器定期下载数据,同时也间歇性地上传数据(分析,广告等),我能做些什么,以尽量减少这些转让的电池寿命的影响?

使用无线电台(2G,3G,LTE等)的传输的电池的影响尤为显著。是否有关于无线射频的功率使用的配置文件,应该不会影响我的选择的时候,是什么,以及如何以尽量减少其对电池寿命的影响?传送数据的任何

解决方案
  

这答案总结从Android培训班,   传输数据,而不会耗尽电池这   解释了如何最大限度地减少下载的电池寿命的影响   与网络的连接,特别是在相对于   无线电。

     

在特定的<一个href="http://developer.android.com/training/efficient-downloads/efficient-network-access.html">Optimizing下载进行有效的网络访问   介绍了无线射频状态机在一些细节并继续   解释如何您的应用程序的连接模式应该与它进行交互   以最小化相关的电池消耗。

无线射频状态机

<一个href="http://developer.android.com/training/efficient-downloads/efficient-network-access.html#RadioStateMachine">Reference

每当你创建一个新的网络连接的无线电将转换到满功率状态。这种转变通常需要大约2秒,所以最小化延迟,无线电引入了延迟,推迟过渡到较低能量状态。

一个典型的3G无线将保持在全功率5秒后,你的传送完成后,移动到待机前,在低能量状态等待另外12秒之内。总共电台将您每次连接时消耗功率将近20秒。

此方法会导致低效率的现代智能手机操作系统,在应用程序在前台(其中等待时间是很重要的)同时运行的应用程序运行在后台(如电池寿命应优先考虑)。

解决方案

的关键在于尽量减少对电池的下载效果是认识到转让的频率比的下载量达到了更巨大的影响。实际上prefetching和和排队/捆绑的转移特别有效。

知道你每次启动一个连接时,你可能会导致无线电吸取功率将近20秒,它捆绑您的数据传输是重要的,这是有效的相移转移是由于相似的时间内发生窗口,让你将每个传输会话过程中尽可能多的数据,以尽量减少会议次数。

同样,prefetching允许您下载所有你可能需要一个给定的时间内一次连拍,通过单一连接,在满负荷的数据。通过前加载你的传输,可以减少下载数据所需的无线电激活次数,节省电池寿命,改善延迟,降低带宽,并减少下载时间。

然而,prefetching还引入通过下载未使用的数据增加电池消耗和带宽利用的危险。

如何积极你prefetch取决于正在下载的数据的大小和它的可能性被使用。一般来说,这是很好的做法,prefetch的数据,这样你只需要启动另一个下载每2〜5分钟,并在1至5兆字节的顺序。

这也是通常更有效的重用现有的网络连接,而不是创造新的方法。重用连接还允许网络更加智能化反应拥塞和有关网络的数据的问题。

If I'm building a smartphone app that regularly downloads data from a server, and also intermittently uploads data (analytics, ads, etc.) what can I do to minimize the battery life impact of those transfers?

The battery impact of transfers using the wireless radio (2G, 3G, LTE, etc.) is particularly significant. Is there anything about the power-use profile of the wireless radio that should affect my choices of when, what, and how to transfer data in order to minimize its impact on battery life?

解决方案

This answer is summarized from The Android Training class, Transferring Data Without Draining the Battery which explains how to minimize the battery life impact of downloads and network connections, particularly in relation to the wireless radio.

In particular Optimizing Downloads for Efficient Network Access explains the wireless radio state machine in some detail and goes on to explain how your app's connectivity model should interact with it to minimize the related battery drain.

The wireless radio state machine

Reference

Every time you create a new network connection the radio will transition to the full power state. This transition typically takes around 2 seconds, so to minimize latency, the radio introduces a delay to postpone the transition to lower energy states.

A typical 3G radio will remain at full power for 5 seconds after your transfer is complete, before waiting a further 12 seconds at the low energy state before moving to standby. In total the radio will draw power for nearly 20 seconds every time you make a connection.

This approach can lead to inefficiencies for apps running on modern smartphone OSs, where apps run both in the foreground (where latency is important) and in the background (where battery life should be prioritized).

Solutions

The key to minimizing the effect of downloads on your battery is recognizing that the frequency of transfers has a more dramatic impact than the size of the downloads. In practical terms prefetching and and queuing / bundling your transfers are particularly effective.

Knowing that every time you initiate a connection you potentially cause the radio to draw power for nearly 20 seconds, it's important to bundle your data transfers so that you're effectively phase-shift transfers that are due to occur within a similar time window so that you're transferring as much data as possible during each transfer session to minimize the number of sessions.

Similarly, prefetching allows you to download all the data you are likely to need for a given time period in a single burst, over a single connection, at full capacity. By front loading your transfers, you reduce the number of radio activations required to download the data, conserving battery life, improving latency, lowering bandwidth, and reducing download times.

However, prefetching also introduces the risk of increasing battery drain and bandwidth use by downloading data that isn't used.

How aggressively you prefetch depends on the size of the data being downloaded and the likelihood of it being used. Generally speaking, it's good practice to prefetch data such that you will only need to initiate another download every 2 to 5 minutes, and in the order of 1 to 5 megabytes.

It's also generally more efficient to reuse existing network connections rather than creating new ones. Reusing connections also allows the network to more intelligently react to congestion and related network data issues.

这篇关于降低应用程序的电池产生的影响下载超过智能手机的无线内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆