简体   繁体   中英

App not entering applicationDidBecomeActive when locked and unlocked while alert in front

So, while Face ID prompt permission coming, I just locking and unlocking my device. app is not entering applicationDidBecomeActive and waiting for user response for that alert. So after answering the alert only app entering applicationDidBecomeActive . But for me app should enter applicationDidBecomeActive while we unlocking the phone itself.
(Note: that alert is from OS so I can't do anything that alert)

for me app should enter applicationDidBecomeActive while we unlocking the phone itself

applicationDidBecomeActive will only be called once the system prompt is dismissed, as you described, so you can't use it in order to detect screen unlock while the system prompt is still displayed.

You can do a different thing. Use a timer and repeatedly check the screen brightness. If you detect a state in which the previous brightness value was 0 and the new value is not 0, you can conclude that the screen was unlocked, even if the app is not active.

However, you will still get false positives if the screen was only tapped without being unlocked, so unfortunately this is not a complete solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM