Android Question B4A - Force screen on?

PhilipK

Member
Licensed User
Longtime User
I've trawled a lot and can't find how to programatically turn on the screen when it is off.

The phone wake states appear to stop the screen going off when it's on but not be able to turn the screen on when it is off.

The Toggle library has toggle.useractivity which might work but I'm unclear on how to set the 'when' variable.:



Many thanks in advance.
 

PhilipK

Member
Licensed User
Longtime User
PhoneWakeState.KeepAlive should turn on the screen. Make sure to call it from a service.

It works, thanks Erel.

PhoneWakeState.KeepAlive does light up the screen when called from a service. Not forgetting to ReleaseKeepAlive later.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…