I'm a beginner to iOS, and want to see if I can have an app note the time that the phone's screen turns on or off. This would basically always be running in the background. I've read a lot of solutions that will work for jailbroken iPhones, or use launch daemons that seem to not be accepted in the Apple Store. Is there any way to gather that info that Apple may be okay with?
The closest thing I've seen seems to be the protectedDataAvailable
property as a flag for if the screen is on or off, but I'm not sure how I could run this continuously in the background and save any time data.
Any help is appreciated, thanks so much!