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