3

Is there a way to retrieve the the amount of time since the battery has been charged?

It doesn't appear like there is a way to do so with BatteryManager, but they show it to you in the settings. I see it here source , but it doesn't appear like there is a way to grab it. Any help?

user2672165
  • 2,986
  • 19
  • 27
John
  • 1,889
  • 6
  • 19
  • 26
  • where do you see the time since the battery was last charged in that source? – Ryan Conrad Jul 16 '10 at 18:53
  • I think it does it around the code at around line 56 and around line 196 – John Jul 17 '10 at 18:07
  • and is there anything you see in this code that makes you think that a/ it displays the time since last charge b/ it is an information you don't have access to? – njzk2 May 08 '14 at 18:03
  • @user2672165 : why are you editing (for trivial spelling issue) a question that was not touched in the last 3.5 years? – njzk2 May 08 '14 at 18:04
  • (there are IBatteryStats and IPowerManager, but apparently they are not used?) – njzk2 May 08 '14 at 18:08
  • @njzk2: You are correct that it is really trivial. Is there a way I can propose some kind of automatic spell checker? Can it be proposed on meta? I don't know if google will find this question anyway? – user2672165 May 08 '14 at 18:09
  • @njzk2: It seems google is able to find it anyway. You are right then there is no real point in fixing it. – user2672165 May 08 '14 at 18:13

1 Answers1

0

You can setup a broadcast receiver for ACTION_POWER_DISCONNECTED, and keep track of the last time it was broadcast.

Doge
  • 6,553
  • 5
  • 24
  • 25
  • but I would like it to grab the correct time even the first time the app is installed and ran – John Aug 19 '10 at 09:11