Is there a away to detect the event when iOS device goes to sleep mode (when the screen gets blackened)?

前端 未结 2 2122
离开以前
离开以前 2020-11-29 03:45

I wanted to detect two events :

  1. Device gets locked/unlocked.
  2. Device goes to sleep and the screen blackens.

First one I have been able t

2条回答
  •  庸人自扰
    2020-11-29 04:24

    You can also subscribe for a notification: "com.apple.springboard.lockstate" and use API SBGetScreenLockStatus to determine status whether device is locked or not.

提交回复
热议问题