Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect key-guard state in android

I have an application that requires to detect the previous state of the key-guard before calling disableKeyguard() or reenableKeyguard(), set by the user! is there any way of accomplishing this task?

like image 454
Sathirar Avatar asked Feb 18 '23 02:02

Sathirar


1 Answers

From documentation

Use

((KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE)).isKeyguardLocked()
like image 74
quinestor Avatar answered Mar 02 '23 22:03

quinestor