Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen Off event or property on iPhone

Is there a way to determine if the screen has been shut off via the top Power button?

I just need to know if the screen has been somehow set to off to kill a loop that updates location.

Thanks

like image 683
chews Avatar asked Nov 11 '08 21:11

chews


1 Answers

Your Application delegate will receive a applicationWillResignActive: message just before the screen is locked (or when the phone rings or another window pops up). This is an excellent time to kill any idle-time processes. After re-activating, you'll receive an applicationDidBecomeActive: message, in which you can restart all this stuff.

like image 91
Ben Gottlieb Avatar answered Nov 07 '22 04:11

Ben Gottlieb