M MCP Member Licensed User Longtime User Jun 1, 2011 #1 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!
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!
XverhelstX Well-Known Member Licensed User Longtime User Jun 1, 2011 #2 Code: Copy Dim p As PhoneWakeState p.KeepAlive(True) p.PartialLock call p.ReleaseKeepAlive p.ReleasePartialLock to disable it You need to have the phone library checked. http://www.b4x.com/android/help/phone.html#phonewakestate XverhelstX Last edited: Jun 1, 2011 Upvote 0
Code: Copy Dim p As PhoneWakeState p.KeepAlive(True) p.PartialLock call p.ReleaseKeepAlive p.ReleasePartialLock to disable it You need to have the phone library checked. http://www.b4x.com/android/help/phone.html#phonewakestate XverhelstX
M MCP Member Licensed User Longtime User Jun 1, 2011 #3 Thanks very much for your help XverhelstX Upvote 0
agraham Expert Licensed User Longtime User Jun 1, 2011 #4 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. Code: Copy 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
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. Code: Copy Dim Obj1, Obj2 As Reflector Obj1.Target = View1 Obj1.RunMethod2("setKeepScreenOn", True, "java.lang.boolean") Obj2.Target = Obj1.RunMethod("getKeepScreenOn") Msgbox(Obj2.ToString, "KeepScreenOn")
M MCP Member Licensed User Longtime User Jun 2, 2011 #5 Thanks for your reply agraham, I'll have a look at that, it may come in useful for other things! Upvote 0