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.
精彩评论