android.view.setKeepScreenOn??

MCP

Member
Licensed User
Longtime User
Hi Folks,

I hope anyone can help with this... I need to be able to keep my app's screen on at all times when it's running in the foreground.
Normally you can do this in the standard Android SDK via the line:-

android.setScreenOn="true"

in your layout.xml file or programmatically:-

view.setScreenOn(True).

I can't seem to find this feature in either the B4A command set nor in the B4A layout designer.

Is this an oversight? If so will it be included in a later version? or is there a solution I have overlooked? I can't seem to find anything in the forums.

Thanks for your help in advance! :)
 

agraham

Expert
Licensed User
Longtime User
As an example you can also get and set it using my Reflection library which is useful for accessing things that Basic4android does not expose.
B4X:
   Dim Obj1, Obj2 As Reflector
   Obj1.Target = View1
   Obj1.RunMethod2("setKeepScreenOn", True, "java.lang.boolean")
   Obj2.Target = Obj1.RunMethod("getKeepScreenOn")
   Msgbox(Obj2.ToString, "KeepScreenOn")
 
Upvote 0

MCP

Member
Licensed User
Longtime User
Thanks for your reply agraham, I'll have a look at that, it may come in useful for other things!
 
Upvote 0
Top