Hello @Erel . I need to use to lock screen when user touches it with his face trying to use the phone (my app does voip phone calls), avoiding mistaken commands. Today I did a workaround creating a full screen activity and then putting a full screen panel consuming the touches (with a 200 alpha and colors.black , with an empty panel_click event in order to consume undesired touches when the proximity value is 0...). But if any other app puts a notification or something else in a layer over this panel I still could have mistaken touches (besides in other app, but it is still a mistaken touch from user)... that's it.
Sub Process_Globals
Private ProximityWakeLock As JavaObject
End Sub
Sub Service_Create
If ProximityWakeLock.IsInitialized = False Then
Dim ctxt As JavaObject
ProximityWakeLock = ctxt.InitializeContext.RunMethodJO("getSystemService", Array("power")) _
.RunMethod("newWakeLock", Array(32, "proximity"))
ProximityWakeLock.RunMethod("acquire", Null)
'release code:
'ProximityWakeLock.RunMethod("release", Null)
End If
End Sub
Sub Process_Globals
Private ProximityWakeLock As JavaObject
End Sub
Sub Service_Create
If ProximityWakeLock.IsInitialized = False Then
Dim ctxt As JavaObject
ProximityWakeLock = ctxt.InitializeContext.RunMethodJO("getSystemService", Array("power")) _
.RunMethod("newWakeLock", Array(32, "proximity"))
ProximityWakeLock.RunMethod("acquire", Null)
'release code:
'ProximityWakeLock.RunMethod("release", Null)
End If
End Sub