计算 iOS 中的电池寿命
想知道除了苹果技术统计数据之外是否还有其他参考资料来计算电池寿命。我尝试比较一些现有的电池应用程序(剩余电池百分比*苹果的数据),但有时我没有得出相同的答案。另外还有使用 2G 电池(而不是 3G)的统计数据,我在 Apple 上没有看到任何关于 2G 电池寿命的信息。
当然,一些应用程序声称它们是“最准确的”......但除非有人拥有非常准确的统计数据来源,否则我不会看到这种情况发生。
Wondering if there are references beyond the Apple tech stats for calculating battery life. I've tried comparing some existing battery apps (battery % left * Apple's figures) and I dont come up with the same answers sometimes. Also there are stats for using 2G cell (as opposed to 3G) and I dont see anything on Apple for 2G battery life.
Of course, some of the apps claim they are 'the most accurate'... but I dont see that happening unless someone has a source for very accurate stats.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该 API 允许您注册以接收电池电量变化的通知。它仅报告向上或向下 5% 增量的变化,但您可以使用计时器并测量两次变化之间的时间(或初始电池电量和第一次变化)。以下是注册通知的方法:
第一个通知告诉您当前状态,例如已拔出、正在充电或已充满。当增量达到 5% 时,第二个就会被触发。
在我看来,如果您收到的只是 5% 的上下变化通知,那么准确性就不是您可以很好或快速计算的东西。如果设备不执行任何操作,5% 的更改可能需要很长时间。
也许您可以使用计时器监视 [[UIDevice currentDevice] BatteryLevel],但是,虽然我还没有尝试过,但我认为它只会以同样的 5% 增量更新。
The API allows you to register to receive notifications for changes to the battery level. It only reports a change at 5% increments up or down, but you can use a timer and measure the time between two changes (or initial battery level and first change). Here's how you register for the notifications:
The first notification tells you the current state, e.g. unplugged, charging, or full. The second will get triggered whenever a 5% increment is reached.
Seems to me that if all you're given is change notifications at 5% changes up or down, accuracy is not something you can calculate very well or quickly. A 5% change could take a very long time if the device isn't doing anything.
Maybe you can monitor [[UIDevice currentDevice] batteryLevel] with a timer, however, while I haven't tried it I think it only gets updated at this same 5% increment.