Setting brightness and applicationWillResignActive
Setting brightness and applicationWillResignActive
- Subject: Setting brightness and applicationWillResignActive
- From: Jim Geist <email@hidden>
- Date: Sun, 22 Jun 2014 20:50:34 -0700
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 (email@hidden)
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:
This email sent to email@hidden