Reputation: 338
Similar to this link
I would like to know it if possible to somehow track battery even when my application is not turned on? My main aspects would be: 1) To get when battery was charged last time and how many %(level) it had then. 2) How many %(level) battery has discharged from its last time being charged.
My goal is: calculate roughly maybe, everytime battery level goes down with 1%. calculate how long it took to drop 1% then look how much % their is left. and do this check every 1%? Then I will be able to calculate time that is left for this battery :) Any help will be appreciated. :)
Upvotes: 0
Views: 299
Reputation: 13541
You can get all this data through the SDK:
http://developer.android.com/training/monitoring-device-state/battery-monitoring.html
Specifically the calculation comes down to what you store and how you use it. Also as for your time/date when it was last charged that comes down to storing that value persistently in your app's sharedpreferences or database (contextual usage depending).
Upvotes: 1