Prevent iPhone from sleeping

I use the accelerometer in my application and I use [UIApplication sharedApplication].idleTimerDisabled = YES; so that the device does not sleep. It works fine, but in this way the screen is always fully lit, is there a way to prevent the device from sleeping and save power saving mode? When idleTimerDisabled set to NO, the device goes into power saving mode before bedtime, I just want the device to not sleep and not support energy saving. Is there any way to do this?

+2
source share
1 answer

There is a property of instances of UIScreen , brightness , this is most likely what you want. Check out the UIScreen brightness property documentation here .

Try:

 [[UIScreen mainScreen] setBrightness: 0.3]; 

NOTE. . When I sent the messages, DarkXphenomenon posted a link to the SO question , whose questionnaire gave the same solution. DarkXphenomenon pulls up quickly.

+5
source

All Articles