Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to an iPhone app when iPhone goes into stand-by mode?

Tags:

My app uses NSTimer and it appears that NSTimer doesn't fire when the iPhone goes into the stand-by mode (either by pressing the hardware button or by the idle timer).

When I activate the iPhone again, my app is still in the foreground. What happens to third party apps when the iPhone is the stand-by mode?

like image 442
subjective-c Avatar asked Jan 04 '09 18:01

subjective-c


People also ask

What is standby mode on iPhone?

The iPhone's Sleep/Wake button sets the device to standby. When you press it, your iPhone switches to sleep mode, which disables the screen while leaving all processes running.

Will iOS terminate the app running in background after a specific time?

No, there is no specific time defined for this.


1 Answers

Although it's not evident here, I believe the original poster did find an answer to his question by starting a thread (available here) in the iPhone Developer Forums (which I eventually had to find myself because the information wasn't shared here).

In case someone else has the same question and finds the page in the future, here's a helpful response that was posted by someone on the Apple forum called "eskimo1" (which I have edited slightly such that it is easier to read without having the context provided by the entire original thread):

  • Regarding iPhone app status terminology, "active" does not mean "awake", it means "attached to the GUI". Think of it being analogous to "frontmost" in Mac OS X. When you lock the device your app deactivates but the device may or may not go to sleep
  • iPhone OS rarely sleeps if the device is connected to main power (i.e., via USB). It can sleep if running on battery, however.
  • A short time after the screen is locked (20 seconds according to Oliver Drobnik), the device sleeps. This is like closing the lid on your laptop; all activity on the main CPU halts.
  • This does not happen if the device is playing audio in the right audio session. See DTS Q&A QA1626 "Audio Session - Ensuring audio playback continues when screen is locked" for details.
  • Note that the idleTimerDisabled property (which can be turned on to prevent the screen from turning off while the app is running) is about locking the screen after user inactivity. It's not directly related to system sleep (it's indirectly related in that the system may sleep shortly after it's locked).
like image 158
Clint Harris Avatar answered Oct 29 '22 22:10

Clint Harris