How can we calculate/ to know, how much battery life my user defined application utilising?

蹲街弑〆低调 提交于 2020-01-15 07:18:06

问题


Here my question is, can we identify, how much battery life my android application is utilising. Because I developed an app based on GPS as well as network, service, broadcast receivers, so I have battery drain problem, so first of all i want to know that how much battery percentage is my application using. Any idea. Thanks in advance.


回答1:


It is difficult to say exactly how much battery life is used by specific application. But, you can refer following links which may give you a little idea.

http://www.androidcentral.com/new-google-services-uses-more-battery-old-and-google-needs-fix-battery-screen-already

http://lifehacker.com/5990553/betterbatterystats-tells-you-exactly-which-apps-are-draining-your-androids-battery

http://www.howtogeek.com/139592/how-to-find-the-root-cause-of-your-android-battery-problems/

Programmatically, you would need to maintain BatteryManager logs for your application in your app itself.

Regarding,battery uses of GPS,network, service, broadcast receivers etc. it depends on how you implement it. Eg:-Use passive providers rather than GPS or network providers also use setinexactrepeating method for alarm manager, etc.



来源:https://stackoverflow.com/questions/22343774/how-can-we-calculate-to-know-how-much-battery-life-my-user-defined-application

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