如何获取有关通过应用程序的Andr​​oid电池使用信息 [英] How to get information about android battery usage by application

查看:109
本文介绍了如何获取有关通过应用程序的Andr​​oid电池使用信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎样才能在Android的每个应用程序的电池使用。

How can I get battery usage per application in Android.

我需要了解%的电池由应用程序中花费的。

I need to know % of battery spent by application.

是否有可能使用SDK?

Is it possible using SDK?

我需要的是这是可以在Android设备上的设置>关于手机>电量使用情况的信息,但对于具体的应用

What I need is the information that's available on an Android device under "Settings>About phone>Battery use", but for specific applications

感谢

推荐答案

该项目是不完整的任何想象的延伸,但我创建了一个应用程序框架(有点...这是目标,它现在还没有)采取同样的措施。请查看 HTTP://syspower.google$c$c.com 。你不能,除非你计算出使用的所有应用程序获得通过应用程序的比例,但你可以得到功耗的定量值。可以很明显的,然后用这些数字来计算的百分比。此外,你应该注意的是,功耗API是私有的,为了获得它,我不得不使用一些反射调用访问私有和隐藏的数据成员。鉴于这种情况,它可能会或可能不会与所有的Andr​​oid版本(我已经与1.6-2.1测试过)的工作。我基本上扭转工程师从开源库中的FuelGuage应用程序。

The project isn't complete by any stretch of the imagination, but I created an application framework (kinda...that was the goal, it's not there yet) to do just this. Check out http://syspower.googlecode.com. You won't be able to get the percentage by application unless you calculate the usage for all applications but you can get quantitative values for power consumption. You can obviously then use those numbers to calculate a percentage. Also, you should note that the power consumption API is private and in order to access it, I had to use a number of reflective calls to access private and hidden data members. Given that, it may or may not work with all Android versions (I've tested it with 1.6-2.1). I basically had to reverse engineer the FuelGuage app from the open source repository.

这篇关于如何获取有关通过应用程序的Andr​​oid电池使用信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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