The default bug view has changed. See this FAQ.

Battery API: Please clarify what values are actually being returned from .chargingTime and .dischargingTime




5 years ago
5 years ago


(Reporter: John Hammink, Unassigned)



Firefox Tracking Flags

(Not tracked)




5 years ago
If I leave my devices plugged in long enough to get .chargingTime  or leave them unplugged long enough to get .dischargingTime (other than Infinity)  I am not sure what values I am seeing.

1.  Does it return seconds, or ms?
2.  Are the values cumulative? for the life of the battery?  
3. If so, what are the start and stop conditions for accumulating these times?  4.  Is there a way to "reset" these values, so I can start from zero?
5.  Where are these values coming from?   For example, in android.os.battery I see no api for getting total charge and discharge times...

For example:
I have been discharging my devices for approximately 5 minutes, long enough for the batteries to drain approx the 2% to generate a dischargingTime value.   

One of my devices returns "240", the other, older device returns 3480.  What do these values mean?

Thanks for your clarification?


5 years ago
Depends on: 699743

Comment 1

5 years ago
What's more, I've noticed that once my charging level goes to 100% (battery fully charged), .chargingTime returns 0.   Is that correct?

And on my older device, charging time returns 336, but I know the device has been charging for longer than that for its lifetime (if the value is, in fact, cumulative).

Comment 2

5 years ago
It took a bit of digging around but I found this:
of type double, readonly
> Represents the time remaining in seconds until the system's battery is fully charged. The

seems to be based on remainingTime where it is the time remaining in seconds until the battery is fully discharged.

I'll update my testpages/testcases accordingly.
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.