On Jun 22, 2014, at 8:50 PM, Jim Geist <velocity...@rodentia.net> wrote:

> 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).

Actually, the setting is explicitly ignored at this time to avoid large 
surprising brightness changes. If I remember correctly, the brightness change 
will be applied the next time the screen cycles between off and on if your 
application is not frontmost.

The system will also normally do this for you without needing to reset it 
during willResignActive.

> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


_______________________________________________

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