安卓电池处于放电模式多久

发布于 2024-11-16 20:06:21 字数 157 浏览 4 评论 0原文

我需要知道我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮倦 2024-11-23 20:06:21

接收 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文