Detecting sleep/wake event in IOS


In IOS, when the device is kept idle for some time, the screen turns off and the device enters sleep mode. It also enters sleep mode when we press the power button to turn the screen off.

In my application, I wanted to detect If the device has entered/exited the sleep mode. I have followed the below links but some of these ways like observing ‘Darwin notifications’ is no longer allowed by apple. Other ways consider the device being locked as sleep mode, which is not precisely correct.

Is there a way to correctly determine this? Please share the apple documentation links if this is possible.

Detect screen on/off from iOS service

https://nemecek.be/blog/104/checking-if-device-is-locked-or-sleeping-in-ios

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img