Turn off screen and lock device

Hitec

Member
Licensed User
Hi

Is it possible to just turn off the screen of the device and lock the buttons without sending the device to suspend?

I'm monitoring GPS location and sending this information to a server. When the device goes to suspend the GPS-Device is turned off and the data connection is disconnected. This is bad as I won't send any localisation data any more. The solution would be to keep the device active, but as the device will be most of the time in a pocket, it consumes too much power to keep the display active. Also the buttons can accidentally been hit.

What I'd like to achieve is to catch the press of the power button but do not send the device to suspend, but turn off the screen and lock the buttons. Another press to the power button should re-enable buttons and screen.

Is this possible?

Thanks!
Thomas
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use the Hardware library to catch the key events and just don't do anything.
Also see KeepAlive in this library, which prevents the device from suspending.
see this thread for a custom library which allows turning the screen off: http://www.b4x.com/forum/questions-help-needed/4298-screen-off.html
It is not possible to capture the power button.
 

schimanski

Well-Known Member
Licensed User
Longtime User
Hello Hitec!

Do you found an answer for this problem? I have tried anything, that Erel says, but the PDA always stops working. When I use the pachpower.dll, hardware.keepalive doesn't prevent, that the pocket-pc is suspending. I have a similar application, that sends the GPS-data to a server and I also have the same problems.

Thanks for answer....
 
Top