So apparently it is possible to keep the processor going processing stuff while the screen is locked, as indicated here:
Running IPhone apps while in sleep mode
However, after testing with the example code, UIAccelerometer will just stop giving value as soon as the device is locked pronto. Is there a way to force otherwise?
Touch and hold the Lock Screen until the Customize button appears at the bottom of the screen, then tap Customize. If the Customize button doesn't appear, touch and hold the Lock Screen again, then enter your passcode. Tap Customize, then tap the box below the time to add widgets to your Lock Screen.
The Lock Screen—which shows the current time and date, your most recent notifications, and a photo or any custom widgets you've added—appears when you turn on or wake iPhone. From the Lock Screen, you can see notifications, open Camera and Control Center, get information from your favorite apps at a glance, and more.
There was a bug in iPhone OS prior to 3.1.2 that caused the accelerometer to stop returning values as soon as the screen was blanked. You may be running into this same issue. I filed a bug with Apple about it and they fixed it in 3.1.2.
One trick I use in an app is to enable the proximity sensor. This allows my app to continue running, but if the user puts their phone in their pocket or otherwise trips the sensor, the screen turns off and doesn't consume power. Meanwhile, my app is still running and (3.1.2 or later) the accelerometer continues sending updates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With