Android Question Screen always on

konisek

Member
Licensed User
Longtime User
How to keep the screen always on during running my app?
Before I used
B4X:
    Dim pw As PhoneWakeState
    pw.KeepAlive(True) 'Display on, bright
 

aminoacid

Active Member
Licensed User
Longtime User
How to keep the screen always on during running my app?
Before I used
B4X:
    Dim pw As PhoneWakeState
    pw.KeepAlive(True) 'Display on, bright

It should still work. It works for me!

Just make sure that "pw.KeepAlive(True)" is placed in Activity_Create
 
Last edited:
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Also works for me here with Android 14. One thing that has never worked for me is the direct switching between dimmed and undimmed wakelock:
B4X:
Dim pw As PhoneWakeState
pw.KeepAlive(True) ‘Display on, bright
then later at some point: (and this does not work!)
B4X:
pw.KeepAlive(False) ‘Display on, dimmed
To make it work, you have to release the wakelock first. So the correct code is:
B4X:
pw.ReleaseKeepAlive
pw.KeepAlive(False) ‘Display on, dimmed
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…