Too bright or not too bright?

I thought I may was well mention this in a very very short post because I took a lot of time out to search for answers. As we all know, there are certain APIs which Apple don’t allow the use of which include some of the more useful features on the iPhone. A couple of days ago, I was looking into controlling brightness and guess what? You can’t do it. Not with the public APIs anyway.

But I wanted to find out if it were possible with any third party APIs and really couldn’t find anything. Yeah, it seems to be ‘that’ simple. I did see reference to using the following code in a couple of websites – but I assure you, this doesn’t seem to work (not in iOS 4.x anyway).

NSNumber *bl = (NSNumber *)CGPreferencesCopyAppValue(CFSTR("SBBacklightLevel"), CFSTR("com.apple.springboard"));
float prevBacklightLevel = [bl floatValue];

This section of code on my simulator and device returns 0 regardless of what your brightness is set at. Okay, so the same website suggested doing this to set the value…

GSEventSetBacklightLevel(1.0f);

This however, doesn’t do anything. Various posts suggest you need to #import the required header before you can use this – but in any case, your app wouldn’t be approved even if you did. So in conclusion, save yourself some time and don’t bother wasting any more time trying to get this working. Most people are using alpha values with bright views to achieve their ‘fade’ effects. Unless you find a private API and don’t mind your app being rejected – don’t bother.

Leave a Reply