开发者

How long android battery is in discharging mode

开发者 https://www.devze.com 2023-03-14 18:39 出处:网络
I need to know how long my android phone is in discharging mode.For this what i am doing now is- using broadcast receiver to listen when phone is unplugged from charging.Then saving this time in memor

I need to know how long my android phone is in discharging mode.For this what i am doing now is- using broadcast receiver to listen when phone is unplugged from charging.Then saving this time in memory.Whenever i need to know the discharging mode period i a开发者_JAVA技巧m finding the difference between current time and the time i have stored previously.

I want to know is there any other way to find this.

Thanks in advance


Recieve the ACTION_POWER_DISCONNECTED and ACTION_POWER_CONNECTED intent:

http://developer.android.com/reference/android/content/Intent.html#ACTION_POWER_DISCONNECTED

And just store the time of the disconnected event.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号