Judge whether the screen is on and whether to unlock the function in Android

1. Whether the screen is on:

2. Whether the screen is unlocked:

The current screen lock has five settings: no screen lock, sliding unlocking, pattern unlocking, pin code unlocking and password unlocking.

If the screen lock is not set, the return value will always be false. If the user sets the screen lock (including any of the last four locks), it returns true when the screen is not on, true before unlocking and false after unlocking.

Sometimes we only need one judgment to meet the needs, but sometimes we need the two to combine to meet the needs.

The above is the function of judging whether the screen is on and unlocked in Android introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>