Screen Off event or property on iPhone
-
08-07-2019 - |
Question
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
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow