5

Is it known how the Android OS estimates time to failure / remaining battery charge? I am doing a school project about battery estimation on mobile devices but have not been able to find any information about which techniques are used in the industry.

Several people have written articles about how time to failure can be estimated on an Android device, but I have not been able to locate any official information about how it is actual done.

The optimal answer I would like is a link to a scientific article or tech-spec that describe it.

  • Where does Android report a time to failure? I've never seen it before. – Peanut May 19 '13 at 13:27
  • Do you mean the time the device can run on the remaining battery charge, rather than the time to failure? – Dan Hulme May 19 '13 at 13:50
  • Yes that it what I mean. I had the understanding that it was the proper technical word to use. – Kim Ahlstrøm Meyn Mathiassen May 19 '13 at 13:54
  • 1
    Have you looked at the source code yet? – Michael Hampton May 19 '13 at 15:51
  • 1
    time to failure = time left on remaining battery charge – CodeTower May 19 '13 at 21:51
2

In the API it is described that the battery percentage is calculated by dividing the current level with the maximum level. This can be seen in the quote below.

This leads me to believe that BatteryManager.EXTRA_LEVEL is either measured in Milli amps Hour (mAh) or a value between 0-100. This is a simple approach and not the answer that I hoped to find but it is an answer never the less. Now I just need a official source that states the answer. :)

Determine the Current Battery Level

In some cases it's also useful to determine the current battery level. You may choose to reduce the rate of your background updates if the battery charge is below a certain level.

You can find the current battery charge by extracting the current battery level and scale from the battery status intent as shown here:

int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);

int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);

float batteryPct = level / (float)scale;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.