kukroid
kukroid

Reputation: 420

Can someone please explain Android BatteryManger parameters

I am confused about the Battery Manager Parameters. can someone please explain below points:

BATTERY_PROPERTY_CHARGE_COUNTER -

Battery capacity in microampere-hours, as an integer.

Ques - Is it the remaining battery capacity or total battery Capacity. If its total , why does it change If its remaining( when i charged my phone 100% ) the values were somethign like 3366079 but total capcity of my phone's battery is 3300 mAh( read from power profile ) How can this be greater than 3300 mAh ?

Integer chargeCounter = mBatteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER);
Integer capacity = mBatteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
Long energyCounter = mBatteryManager.getLongProperty(BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER);

long batteryCapacity = (chargeCounter/capacity) *100;

logs are as foolow :

Charge Counter: 3366079 capacity 100 Battery Capacity is :3366000

BATTERY_PROPERTY_ENERGY_COUNTER

Battery remaining energy in nanowatt-hours, as a long integer.

This parameter returns 0 ( tested on 2 devices ) Ques - Should this value be the remaining battery capacity value off 3300 mAH? or else what does this mean ?

Devices Used - LG G6 and Pixel 1

Thanks

Upvotes: 1

Views: 1054

Answers (1)

aaroncio
aaroncio

Reputation: 307

There are a lot of physics behind these questions, for the first one, How can this be greater than 3300 mAh ? When manufacturers make a new battery they make them using a range, if your battery says it is 3300mAh there will be a range of error of +/- some error percentage. Also to measure the battery they use a sensor which is prone to certain percentage of error too. All these measures are converted from analog to digital which also conducts to another error. I think this link could help: https://source.android.com/devices/tech/power/device

For your second question, check this post: Android BATTERY_PROPERTY_ENERGY_COUNTER returning fixed value?

Upvotes: 1

Related Questions