My iOS application needs to keep the device active by disabling the idle timer, 
but dims the display to conserve battery since it will be running for long 
periods. This works fine, but I want to make sure to restore the user’s 
settings if the app is switched away from.

The code sets [UIScreen mainScreen].brightness back to the original settings in 
a handler for UIApplicationWillResignActiveNotification. However, setting the 
brightness here is ignored (as is doing it in the applicationWillResignActive: 
handler in the application delegate). I think the problem is that by the time 
the notification is sent, the application is already past the point where it 
owns the screen (a breakpoint on the handler doesn’t fire until after the app 
is off the screen). applicationDidEnterBackground: doesn’t work, either.

StackOverflow, in previous threads on this, suggests rendering an alpha’ed 
black rectangle over the app, but that’s not really useful when the intent is 
to save battery life.

Anyone have any ideas?

Thanks!!


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to