Disable & Enable Idle Timer in iOS SDK

March 2, 2011 § 2 Comments

By default, the idle timer will dim the screen after a period of non use and then turn the power to the screen off. You may need to disable idle timer on a specific app such as a Flash light app or location-based app.

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

}

Add the following line:
[application setIdleTimerDisabled:YES];

- (void)applicationWillTerminate:(UIApplication *)application {

}

Add the following line to re-enable the idle timer:
[application setIdleTimerDisabled:NO];

This won’t work on the Simulator but it definitely works on device.

About these ads

§ 2 Responses to Disable & Enable Idle Timer in iOS SDK

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Disable & Enable Idle Timer in iOS SDK at Web Builders.

meta

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: