Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep iPhone from sleeping [duplicate]

How can I keep the iPhone from sleeping?

like image 779
Linuxmint Avatar asked Mar 08 '11 18:03

Linuxmint


People also ask

How do I stop my iPhone from sleeping automatically?

Turn off all sleep schedules and alarmsTap Browse at the bottom right, then tap Sleep. Scroll down to Your Schedule. Tap Full Schedule & Options, then turn off Sleep Schedule (at the top of the screen). You can turn them all on again later.

Why does my iPhone automatically sleep?

The reason your iPhone's screen keeps dimming and turning off is because of a feature called “Auto-Lock,” which automatically puts the iPhone into a sleep/lock mode after a certain period of time. Two-thirds of the way through the set period, the screen dims to half brightness.


1 Answers

To stop your app from timing out and going to sleep you can use:

[UIApplication sharedApplication].idleTimerDisabled = YES; 

This will, obviously, disable the idle timer and stop your iphone from automatically going into sleep mode.

Edit: As middaparka stated you should re-enable the idle timer when you no longer need to keep the phone awake (generally after that view has been removed) using:

[UIApplication sharedApplication].idleTimerDisabled = NO; 

Cheers

like image 112
Brenton Morse Avatar answered Sep 17 '22 18:09

Brenton Morse