views:

940

answers:

0

Hi, I'm writing a mapping application that is required to run even when the iphone is locked. so, in my application's applicationDidFinishLaunching method I call,

application.idleTimerDisabled = YES; and revert it back when application exits.

But there seems to be a lot of issues with this.

When the iPhone is tethered and the app is started from XCode, the idleTimer is disabled. When the iPhone is un-tethered, iphone sleeps after the set 1 minute time after locking it. However, if iPod is running the background, my app seems to collect data after locking the iPhone.

I could come to a conclusion that, idleTimerDisabled = YES is not getting happening properly. So I used the other way, [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; that also didn't help and I'm out of thoughts...

In the aurioTouch example from Apple, they have used application.idleTimerDisabled = YES rather than using the sharedApplication singleton instance.

Some discussions on Apple website also didn't help... (http://discussions.apple.com/thread.jspa?threadID=1651649)

Can someone please help...?

UPDATE: when the screen is left unlocked, the app works fine. otherwise, even if idleTimerDisabled is set, it does go to sleep unless iPod is running in the background.