Avoid the iphone go into sleep mode

Zeeshan Rang picture Zeeshan Rang · Nov 29, 2009 · Viewed 14.5k times · Source

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

Answer

epatel picture epatel · Nov 29, 2009

Try this

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];