安卓电池处于放电模式多久
我需要知道我的 Android 手机处于放电模式多长时间。为此,我现在正在做的是 - 使用广播接收器监听手机何时从充电中拔出。然后将此时间保存在内存中。每当我需要知道放电模式时我发现当前时间和我之前存储的时间之间的差异。
我想知道还有其他方法可以找到这个吗?
提前致谢
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 am 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
接收 ACTION_POWER_DISCONNECTED 和 ACTION_POWER_CONNECTED 意图:
http://developer.android.com/参考/android/content/Intent.html#ACTION_POWER_DISCONNECTED
并且只存储断开连接事件的时间。
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.