 |
 |
|
 |
11-11-2008, 09:15 AM
|
#1 (permalink)
|
|
Member
Join Date: Aug 2008
Posts: 77
Rep Power: 1
|
adjusting screen brightness
I assume you need to jailbreak to get access to system controls like this, but I'll throw this out there in case someone has discovered a handy solution...
|
|
|
11-11-2008, 09:36 AM
|
#2 (permalink)
|
|
Senior Member
Join Date: Aug 2008
Posts: 211
Rep Power: 1
|
I believe the application 'Light' was removed from the store for messing with the screen brightness.
|
|
|
11-11-2008, 09:40 AM
|
#3 (permalink)
|
|
Member
Join Date: Nov 2008
Posts: 74
Rep Power: 1
|
Yes, Apple will reject your app if you mess with the brightness. Although, if you still want to do it, you'd get the current brightness like this:
Code:
-(void)getBacklightLevel;{
NSNumber *bl = (NSNumber*) CFPreferencesCopyAppValue(CFSTR("SBBacklightLevel" ), CFSTR("com.apple.springboard"));
previousBacklightLevel = [bl floatValue]; //a variable to store the previous level so you can reset it.
[bl release];
}
And to set the backlight level, add this line
Code:
GSEventSetBacklightLevel(newLevel); //The new level: 0.0 - 1.0.
In order for this to work, you will need to include GraphicsServices.h. Depending on where you get your headers, you may need to add the GSEventSetBacklightLevel(float value); method to the headers, else the method won't quite work. [Some have reported kernel panics by not amending the header, but that has not been my experience]
|
|
|
03-29-2009, 03:32 PM
|
#4 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Sep 2008
Location: London, UK
Posts: 704
Rep Power: 1
|
Quote:
Originally Posted by SkylarEC
Yes, Apple will reject your app if you mess with the brightness. Although, if you still want to do it, you'd get the current brightness like this:
Code:
-(void)getBacklightLevel;{
NSNumber *bl = (NSNumber*) CFPreferencesCopyAppValue(CFSTR("SBBacklightLevel" ), CFSTR("com.apple.springboard"));
previousBacklightLevel = [bl floatValue]; //a variable to store the previous level so you can reset it.
[bl release];
}
And to set the backlight level, add this line
Code:
GSEventSetBacklightLevel(newLevel); //The new level: 0.0 - 1.0.
In order for this to work, you will need to include GraphicsServices.h. Depending on where you get your headers, you may need to add the GSEventSetBacklightLevel(float value); method to the headers, else the method won't quite work. [Some have reported kernel panics by not amending the header, but that has not been my experience]
|
wow sorry to raise such as an old thread, but does anyone know if this still works. I can't seem to return the current backlight value anymore (I'm sure it worked once)....its for a private app BTW so no App store violations
TIA, Michael.
|
|
|
05-01-2009, 08:13 PM
|
#5 (permalink)
|
|
Junior Member
Join Date: May 2009
Posts: 4
Rep Power: 0
|
Quote:
Originally Posted by lapse
I believe the application 'Light' was removed from the store for messing with the screen brightness.
|
I've seen two applications ("Astronomy Flashlight" and "Flashlight.") in the store that adjust the screen's brightness one way or another. They probably don't adjust the system brightness but they seem to have a way to "dim" the screen. Any ideas? It appears possible if (at least) two apps have made it into the store.
|
|
|
05-01-2009, 09:17 PM
|
#6 (permalink)
|
|
Junior Member
Join Date: Apr 2009
Posts: 11
Rep Power: 0
|
Sneaky..!
Quote:
Originally Posted by SkylarEC
In order for this to work, you will need to include GraphicsServices.h. Depending on where you get your headers, you may need to add the GSEventSetBacklightLevel(float value); method to the headers, else the method won't quite work. [Some have reported kernel panics by not amending the header, but that has not been my experience]
|
|
|
|
05-02-2009, 08:59 AM
|
#7 (permalink)
|
|
FasterThanMonkeys.com
iPhone Dev SDK Supporter
Join Date: Mar 2009
Location: Southern California
Posts: 410
Rep Power: 1
|
I think Flashlight may just be using different color backgrounds... gray's appear dimmer than whites.
|
|
|
05-02-2009, 11:16 AM
|
#8 (permalink)
|
|
Junior Member
Join Date: May 2009
Posts: 4
Rep Power: 0
|
Quote:
Originally Posted by ftm
I think Flashlight may just be using different color backgrounds... gray's appear dimmer than whites.
|
Perhaps, but that doesn't explain how "Astronomy Flashlight" works and even if "Flashlight." does just use grays, how does it fade from one color to the gray?
|
|
|
05-02-2009, 11:33 AM
|
#9 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Sep 2008
Location: London, UK
Posts: 704
Rep Power: 1
|
Quote:
Originally Posted by lewis
Perhaps, but that doesn't explain how "Astronomy Flashlight" works and even if "Flashlight." does just use grays, how does it fade from one color to the gray?
|
they don't adjust the backlight levels...all they are doing is adjusting the alpha level of the top (red) view.
|
|
|
05-03-2009, 02:38 PM
|
#10 (permalink)
|
|
Junior Member
Join Date: May 2009
Posts: 4
Rep Power: 0
|
Quote:
Originally Posted by wuf810
they don't adjust the backlight levels...all they are doing is adjusting the alpha level of the top (red) view.
|
Oh, I see. Thanks.
So does anyone know how to find the GraphicsServices library? I know I won't be able to submit it to the App Store, but I can still use it personally, can't I? I located the GraphicsServices.framework (several, actually), but when I try and expand it there are no headers listed? Did Apple just remove access to this completely or is there something else that needs to be done? TIA.
|
|
|
05-03-2009, 02:57 PM
|
#11 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Sep 2008
Location: London, UK
Posts: 704
Rep Power: 1
|
Quote:
Originally Posted by lewis
Oh, I see. Thanks.
So does anyone know how to find the GraphicsServices library? I know I won't be able to submit it to the App Store, but I can still use it personally, can't I? I located the GraphicsServices.framework (several, actually), but when I try and expand it there are no headers listed? Did Apple just remove access to this completely or is there something else that needs to be done? TIA.
|
check out this link The iPhone SDK: APIs Apple Didn't Want You to Know About | O'Reilly Media
It has all the info you need but its quite complicated if you are new to this sort of stuff.
M.
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
|
» Online Users: 173 |
| 10 members and 163 guests |
| Alexman, atsd, BostonMerlin, lepetitapps, Neverever, P-atr1k, Raphy, Sekharbethalam, Slecorne, _mubashir |
| Most users ever online was 779, 05-11-2009 at 09:55 AM. |
» Stats |
Members: 8,172
Threads: 20,132
Posts: 89,979
Top Poster: RickMaddy (2,121)
|
| Welcome to our newest member, juicysen |
|