Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: Can I programmatically disable auto turning off the display? [duplicate]

I recently started developing iPhone apps in Objective-C and put together a small universal video player which allows me to view TV shows, movies and the like on my iPhone. Everything is working flawlessly except one minor thing.

The display always turns off after a minute or two and turns black if I don't tap the screen within that time span.

I'm wondering whether it's possible to programmatically keep the display on while my app is open. I've already tried setting idleTimerDisabled to true, without success, though.

My device is jailbroken if it makes a difference and I'm also open for solutions that would work on jailbroken devices only (if there are any solutions for this scenario).

like image 616
beta Avatar asked Mar 28 '13 20:03

beta


People also ask

How do I stop my iPhone from turning off automatically?

1. Stop iPhone Screen From Turning Off Automatically. All that is required to Prevent iPhone Screen from automatically switching OFF is to go to Settings > Display & Brightness > Auto-Lock > on the next screen, select the Never option.

How do I stop my screen from turning off?

All you need to do is click on the settings menu from the notification panel or the app drawer and go to the settings icon. Now click on the Display icon. Click on Screen Timeout and click on the Never option. After Clicking on Screen timeout your phone screen will stop turning off.


1 Answers

In AppDelegate add:

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions...

//Add this to your method
[UIApplication sharedApplication].idleTimerDisabled = YES;
like image 124
William Falcon Avatar answered Oct 09 '22 21:10

William Falcon