Android App programming and energy-efficiency [closed]

心不动则不痛 提交于 2019-12-10 11:36:40

问题


ATM, I'm searching through open source/close source android applications to identify particular concerns (code blocks, code patterns) that rise energy issue as my interests and part of studies.

For example, code that

  • turning on GPS for longer than necessary , or
  • refreshing display unnecessarily.

So,

  • Is there any suggestion how I can go about searching those concerns and possible fixes?

  • any professional Android programmers could suggest some common practices that saves energy with example code?

Thanks in advance, sorry for asking an a bit open-ended question.


回答1:


Actually the Android developers wrote a great guide on Designing for Performance so that you could save battery life by not running the CPU full blast all of the time and not running the hardware so much. But the basic gist is to minimise:

  • CPU utilization time (do not keep it sitting at 100% usage and use Alarm Manager if that is all you need)
  • Hardware Use (do not sit there polling the GPS)
  • Screen Use (If you do not need to have the screen on, or it can go dim then let it; do not display a bright white background constantly)

Basically, any use at all will drain the battery and the battery is energy, whatever wastes the devices energy wastes the battery so you should minimize it.



来源:https://stackoverflow.com/questions/6326285/android-app-programming-and-energy-efficiency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!