views:

630

answers:

2

Hi

I have made an iphone fitness application. The issue i am unable to resolve here is that, while the application is running, the iphone goes in the sleep mode, and hence the accelerometer and sound turns off. Which i dont want to happen.

Is there anyway i can avoid this from happening? If not that, atleast i could increase the time of my iphone to go into sleep mode.

Regards Zeeshan

+10  A: 

Try this

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
epatel
one more link http://cocoabugs.blogspot.com/2010/10/how-to-aviod-application-going-to-sleep.html
jeeva
+3  A: 

As Jacob and epatel said, the [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ]; is the way you wanted. However, you'd better to implement when the application is interrupted by other signal. It means that you'd implement - (void)applicationWillResignActive:(UIApplication *)application method.

Because, there are enforced interruption on the iPhone/iPod touch. A phone call, push a power button, and so on.

KatokichiSoft