This is how I set the brightness programmatically, but if I lock and then unlock the iPhone, the brightness level will be reset to the original:
GSEventSetBacklightLevel(BrightnessSlider.value);
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
So I would like to ask you, how to set the brightness, but also have its new value retained across screen locks and unlocks.
On iOS 5, you can use the brightness property of UIScreen: