Prevent iPhone to sleep

I using accelerometer in my app and i'm using [UIApplication sharedApplication].idleTimerDisabled = YES; to prevent the device to sleep. It works fine, but this way the screen is always on full bright, there is a way to prevent the device to sleep and keep the energy economy mode on? When idleTimerDisabled is stetted to NO the device enter in the energy economy mode before sleep, i just want to prevent the device to sleep and keep the energy economy. There is a way to do that?


There's a property of UIScreen instances, brightness, that is likely what you want. Check out the documentation of UIScreen's brightness property here.


[[UIScreen mainScreen] setBrightness: 0.3];

NOTE: As I was posting, DarkXphenomenon posted a link to an SO question whose asker gave the exact same solution. DarkXphenomenon is quick on the draw.

Need Your Help

RichFaces, a4j:ajax rerender after valueChangeListener call

ajax richfaces rerender

Look my jsf, please: or

Gridview - Update event not fire gridview row edit

When I click the "Edit" button of the gridview, it will show "Update" and "Cancel" button. But when I click "Update" button, it will not fire any event "RowUpdating", RowUpdated", "RowCommand"... It