What are the most battery-consuming things you can do in an iPhone-app?

喜你入骨 提交于 2019-12-04 09:40:11

问题


I am making an app that quickly drains the users battery. For this, I am planning on using the sound-framework for vibrating, location services, download large but empty files from the internet, use the flashlight on the back of the phone, and so on. I know these can effectively drain the battery, but I would like to know if there are more methods that are more or equally power/processor-consuming or that could work for this in any way?

Examples on how to achieve 100% CPU usage is also very appreciated.

Thanks.


回答1:


Here are some of the things you could do (Most of these are possible to do programatically. i.e. they can all be turned on one by one as soon as your app starts) -

  1. Turn on System Services (Not sure this is possible programmatically)
  2. Turn on Location Services. i.e. GPS-Based Time Zone Detection & Others with max. update frequency & keep moving the phone around to get GPS working.
  3. Turn on Push notifications with minimum of 15 minute interval.
  4. Turn on iCloud support.
  5. Turn on Notifications.
  6. Make screen brightness highest & Set the iPhone not to lock.
  7. Turn on AirPlay (one of the fastest ways I have seen battery drain).
  8. Turn on the 3G, Wi-Fi radios.
  9. Turn on Bluetooth radios & connect to a headset.
  10. Play music through built-in speaker.
  11. Use maps in your app & turn on the “Locate Me” feature using GPS. Leave the iPhone to it.
  12. Try to get 100% CPU usage (as suggested by Matthias). But be careful, lest watchDog will shut your app down without second thought.
  13. Do some OpenGL rendering (as suggested by Matthias).
  14. Turn on your Camera LED & keep it on.
  15. Turn on all sensors in your device. Accelerometer, Gyroscope & set it so that your app receives maximum updates i.e. keep the update intervals shortest possible & move the phone around.

Most likely the battery will drain within 2 hours.

One suggested way for you to achieve 100% CPU usage using threading - Background threads consuming 100% CPU on iPhone 3GS causes latent main thread. But be careful...



来源:https://stackoverflow.com/questions/8687883/what-are-the-most-battery-consuming-things-you-can-do-in-an-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!