Q:

How to get the capacity of the battery in code

I am trying to read the capacity of the battery in code, but so far I haven't succeeded.  Does anyone know how to read the battery capacity programmatically?
I need a code snippet or some reference as to where to search.

A:

You might want to look at this question. You use the ACTION_BATTERY_CHANGED intent to get the information. You would use the BatteryManager to get the constants. I believe that constant that you would be looking for is EXTRA_SCALE

