I'm having trouble trying to access most of the data from my battery of Android devices, such as BATTERY_PROPERTY_CAPACITY, BATTERY_PROPERTY_CHARGE_COUNTERor BATTERY_PROPERTY_CURRENT_AVERAGE. These properties are clearly described here: http://developer.android.com/reference/android/os/BatteryManager.html
I have the following permission declared in my manifest:
<uses-permission android:name="android.permission.BATTERY_STATS" />
I have a non-zero instance of BatteryManager:
mBatteryManager = (BatteryManager) getSystemService(BATTERY_SERVICE);
And whenever I try to get this data:
double remainingCapacity = mBatteryManager.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
double batteryCapacityMicroAh = mBatteryManager.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER);
double averageCurrentMicroA = mBatteryManager.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE);
All results are equal to 0. Always, without fail, 0. I tried it on the emulator, in fact, and everything that I thought about, could not change my results.
. , , , , , ( ). .