BatteryManager
provides an API to get the current charging or drawn using the BATTERY_PROPERTY_CURRENT_NOW
property. However the min SDK level for this API is 21. I have seen some working apps that are compatible with API 16 devices and the measurement seems to be accurate.
My question is how to achieve the same capability on devices below SDK 21?
I would appreciate any details specifically about:
- Whether it possible that they fake the output mA by detecting if the device is plugged in to a charger or USB connection?
- Whether there indeed a way to use BATTERY_PROPERTY_CURRENT_NOW property on older devices?
- Whether there a way to determine the current drawn or charged on API 16?
Edit: I was wrong..
It seems the ampere/charging apps build on API 16 just lie, I tested a few of them with an ammeter in series with a phone and then with a tabled, the ammeter measures about 420 mA for the tabled and 370 mA for the phone, but the apps i tested display different numbers, they probably just test if the conection is USB or wall charger, and then they display a random number between 800mA and 1200 mA for wall chargers and a random number between 300mA and 500mA for USB data connections ammeter test