I have found the answer for this in iPhone: Detecting user inactivity/idle time since last screen touch but what happens when the device gets into inactive/sleep state? The timer stops firing right?
-
Have you tried writing any code to test this? – Joe Jun 19 '12 at 20:43
-
Now, I am thinking of using a background to monitor the specific state instead relying upon Timer due to this limitation. – anonmys Jun 21 '12 at 05:10
1 Answers
A timer is not a real-time mechanism; it fires only when one of the run loop modes to which the timer has been added is running and able to check if the timer’s firing time has passed. Because of the various input sources a typical run loop manages, the effective resolution of the time interval for a timer is limited to on the order of 50-100 milliseconds. If a timer’s firing time occurs during a long callout or while the run loop is in a mode that is not monitoring the timer, the timer does not fire until the next time the run loop checks the timer. Therefore, the actual time at which the timer fires potentially can be a significant period of time after the scheduled firing time.
So, when your app will go to an inactive state - the timer will stop firing. And when your app will go back to an active state - the timer will resume firing again.

- 1,123
- 11
- 18