0

I'm using this API to set the brightness of the screen in my app(Unity3D/ObjC plugin)

[UIScreen mainScreen].brightness = myBrightness;

When I push the home button, the brightness is never restored, as the documentation explicitly states it should be:

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreen_Class/#//apple_ref/occ/instp/UIScreen/brightness

The system restores the user-supplied brightness setting at appropriate times when your app is not in the foreground. So if you change the value of this property, you do not need to record the previous value and restore it when your app moves to the background.

I'm also using this Unity3D API to make sure the screen doesn't go to sleep, but instead just dims when I tell it to:

Screen.sleepTimeout = SleepTimeout.NeverSleep;

Why does the brightness not reset?

note: I mention Unity3D because I'm wondering if Unity could be causing this problem. Is there anything Unity could be doing that would prevent the brightness from resetting?

1 Answer 1

1

The system restores the user-supplied brightness setting at appropriate times when your app is not in the foreground.

They do not say that the brightness will change back immediately, it says at an appropriate time. I would not worry that you broke Apples api. Apps are pretty sandboxed and you do not need to worry what is going on outside of your app.

1
  • 1
    So minimizing my app and starting a completely different one is not considered an "appropriate" reason to restore the system brightness setting back from 0.1 where I put it? <sarcasm>Man... they must have a deep neural net behind that AI</sarcasm> ;) Aug 21, 2015 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.