My app uses BatteryManager.BATTERY_PROPERTY_CURRENT_NOW to get the battery current of the device:
BatteryManager batteryManager = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
int current = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW), context);
However, it does not work for example on a Samsung Galaxy Tab A. There it returns just 0.
Other apps show the current even on that device. How do they do it? What are alternatives to my method?
from BATTERY_PROPERTY_CURRENT_NOW not working on every device. What are alternatives?
No comments:
Post a Comment