获取电池电流值Android手机 [英] Getting the battery current values for the Android Phone

查看:1494
本文介绍了获取电池电流值Android手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想收集了Android G1手机电量的统计数据。我想知道电压和电流的值,然后能够收集统计数据的报道在此的 PDF

I am trying to collect power usage statistics for the Android G1 Phone. I am interested in knowing the values of Voltage and Current, and then able to collect statistics as reported in this PDF.

我能够通过注册为一个意图接收机接收广播的ACTION_BATTERY_CHANGED获得电池电压的值。但问题是,Android不通过此SDK接口暴露的电流的值。

I am able to get the value of Battery voltage through registering for an intent receiver to receive the Broadcast for ACTION_BATTERY_CHANGED. But the problem is that Android does not expose the value of current through this SDK interface.

我试过的方法之一是通过sysfs的界面,在这里我可以从亚行外壳查看电池的电流值,使用下面的命令

One way I tried is via sysfs interface, where I can view the battery current value from adb shell, using the following command

$cat /sys/class/power_supply/battery/batt_current
449 

但是,这也只有当手机通过USB接口连接。如果我断开手机,我看到batt_current为'0'的值。我不知道为什么当前报值为零。它应该是大于零,对不对?

But that too works only if the phone is connected via USB interface. If I disconnect the phone, I see the value of batt_current as '0'. I am not sure why the value of current reported is zero. It should be more than zero, right?

任何建议/指针获取电池电流值?也请纠正我,如果我错了。

Any suggestion / pointers for getting battery current value? Also please correct me if I am wrong.

推荐答案

经过多次实验和其他各种团体的帮助,我才发现原来是没有办法通过软件让电池电流值仅为(其不支持在H / w)的。只有这样,我发现这是由万用表来测量电流流过电池。

After several experiments and help from various other groups, I found out that there is no way of getting Battery Current value through software only (as its not supported in h/w). Only way I found was to measure current flowing through battery by means of multimeter.

这篇关于获取电池电流值Android手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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