问题
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) -
- Turn on System Services (Not sure this is possible programmatically)
- 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.
- Turn on Push notifications with minimum of 15 minute interval.
- Turn on iCloud support.
- Turn on Notifications.
- Make screen brightness highest & Set the iPhone not to lock.
- Turn on AirPlay (one of the fastest ways I have seen battery drain).
- Turn on the 3G, Wi-Fi radios.
- Turn on Bluetooth radios & connect to a headset.
- Play music through built-in speaker.
- Use maps in your app & turn on the “Locate Me” feature using GPS. Leave the iPhone to it.
- Try to get 100% CPU usage (as suggested by Matthias). But be careful, lest watchDog will shut your app down without second thought.
- Do some OpenGL rendering (as suggested by Matthias).
- Turn on your Camera LED & keep it on.
- 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