Control or Disable Power On/Off Button

Comalco

Member
Licensed User
Longtime User
I have an situation where I am mounting a tablet behind glass and I do not wish the power button to be active. The tablet has permanent power applied so the battery running down is not really a concern, but I am wondering if it is possible to detect voltage is OK and auto-turn on. i.e. auto-on if power DOES get disconnected and re-connected for some reason. And, also, to disable the on/off button so it could not accidentally turn the tablet off..........I don't think the PhoneWakeState is enough here?? thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You cannot disable the power button.

Try the following steps:
- Start a service and call Service.StartForeground
- Listen to the SreenOff event with PhoneEvents.
- In this event schedule the service to restart in x seconds with StartServiceAt.
- In Service_Start acquire a power lock with PhoneWakeState.
 
Upvote 0
Top