最大限度地减少 iOS 上应用程序的电池使用量(当手机锁定时等)
我注意到,从 iOS 4.0 开始,我开发的应用程序在按下主页按钮时开始不会“退出”,而是停留在双击系统时弹出的“系统托盘”中。
大约在同一时间,我注意到手机电池的电量开始消耗得更快。话又说回来,理论上所有应用程序现在应该使用的只是内存,因为它当前未处于活动状态。
这就引出了一个问题,是否有任何基准来衡量 iPhone 电池消耗最多的原因?也许opengl调用,使用显卡会消耗不少?或者,也许只是让应用程序处于活动状态就意味着内存较少,这会导致电池损耗更快(例如,因为内存分配器必须执行更多工作等)?
我很想知道其他开发人员已尝试采取哪些措施来优化电池使用。
I've noticed that since iOS 4.0, the apps I developed started to not "exit" when the home button is pressed, but rather they stay in the "system tray" thing which pops out when you double click the system.
At around the same time, I noticed that the battery in my phone starts draining a lot faster. Then again, theoretically all the app should be using right now is only memory, because it is not currently active.
Which begs the question, has there ever been any benchmark on what causes the iPhone to drain the most batteries? Perhaps opengl calls, which use the graphics card would consume quite a bit? Or maybe just having the apps active mean there's less memory, and this causes faster battery loss (say, because the memory allocator must do more work etc)?
I am keen to know what other developers have tried to do to optimise battery usage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不是 opengl 或分配导致电池耗尽,事实上,当应用程序退出时,变量会保存在硬盘上。 它们不会保留在内存中,因为同时运行所有应用程序是不可能的。(参见评论)
特别感谢 Stephen Furlani 提供本指南 文档
我认为唯一可以导致更快耗尽的是后台进程仍然接受在后台运行,例如 Skype 的 IP 语音功能。 (big 在当时的 iOS 4 SDK 预览版中宣布的功能)。背景音频/视频、网络传输(如潘多拉)等(我不能说出全部),但不是每个应用程序!
顺便说一句,我还注意到我的电池在其他日子有时无法保持尽可能长的时间。但我无法找到哪个应用程序导致了:(
its not opengl or allocations that cause the battery drain in fact the variables are saved on the hard disk when the application quit. They don't stay in memory cause this wouldn't be possible with running all apps at the same time. (see comments)
special thanks to Stephen Furlani for this guide in documentation
I think the only ones that can cause the faster drain are background processes that still accepted to be run in background like the voice over IP feature from Skype. (the features where big announced at the iOS 4 SDK preview back then). Background audio/video, network transfers like pandora etc. (I can't name all) but not every app!
And by the way, I also noticed that my battery sometimes not hold as long as possible on other days. But I can't locate which App cause that :(