How to find the screen is locked in android

后端 未结 6 1336
猫巷女王i
猫巷女王i 2020-12-03 11:47

For my application, I need to know that the screen is locked. How to check this is problematically. I used following flag:

if(WindowManager.LayoutParams.FLAG         


        
6条回答
  •  孤城傲影
    2020-12-03 11:55

    There are broadcasted intents for screen lock & unlock.

    Check it like :

    if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){//LOGIC Here}
    

    Let me know!

提交回复
热议问题