Well, OK. Select the Reflection library. The sub bellow will set a variable - 'DeviceLocked' to either 0 or 1:
Sub CheckLock
Dim r As Reflector
Dim isLock As Boolean
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "keyguard", "java.lang.String")
isLock = r.RunMethod("inKeyguardRestrictedInputMode")
If isLock = False Then
DeviceLocked = 0
Else
DeviceLocked = 1
End If
End Sub
Don't take this the wrong way, I am just trying to teach you how to program faster/easier
B4X:
Sub CheckLock as boolean
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "keyguard", "java.lang.String")
return r.RunMethod("inKeyguardRestrictedInputMode")
end sub
Don't take this the wrong way, I am just trying to teach you how to program faster/easier
B4X:
Sub CheckLock as boolean
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "keyguard", "java.lang.String")
return r.RunMethod("inKeyguardRestrictedInputMode")
end sub