What is the proper way to call computeChargeTimeRemaining ? The method doesn't exist when I try:
BatteryManager mBatteryManager = (BatteryManager)context.getSystemService(Context.BATTERY_SERVICE);
long time = mBatteryManager.computeChargeTimeRemaining();
Set your
compileSdkVersionto 28 (or higher, if you are reading this in the distant future).Note that this method will only be available on Android 9.0+ devices. So, unless your
minSdkVersionis 28 (or higher, for those of you reading this from your flying cars), you will need to take steps to only call this method on compatible devices: