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
compileSdkVersion
to 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
minSdkVersion
is 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: