Help with PartialLock

solas

Member
Licensed User
Longtime User
Hi all, I'M a noobie and I'm working on an app that requires the phone/screen lock to be disabled (in code) I need the app to keep running (but turn the screen off for power saving purposes) I have been looking into PartialLock and KeepAlive but can find no snippet of code to demonstrate how to use them, specifically can anyone point me in the direction of a snippet of code that will show me how PartialLock works. Thanking you in advance Solas
 

solas

Member
Licensed User
Longtime User
Hi Erel I'm not sure of anything, I'm just trying to get the hang of all the features of B4A and I am using this as a learning exercise. The syntax layout for PartialLock has me stumped (I cant find an example for it ) basically I want to run an app that is always on the screen but with the power drain minimized,the screen could shut down until woken by the Accelerometer. Once I have managed this my next exercise will be to try to shift as much code as I can to service modules PS I realize that this is posted in the wrong room and if you want to shift the thread to a more appropriate room that's fine sorry about the hassle
rgs Solas
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
@solas

What does the partial lock do? Just turn off the screen but keep the app alive?

And then ReleasePartialLock will bring it "back to life"?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
And that prevents your device from going to sleep or prevents the screen from dimming? In other words, it keeps your device active?
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
A partialLock, since leaving CPU to continue working, would prevent WIFI from turning off, in case of course we've already set this property to 'never'?
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Partial lock forces the CPU to keep running. It does nothing with the screen.

but once the user presses the power button slightly, the CPU might still be working but your app is paused, thus you can't use any timer event you set. e.g: vibrate the phone every "so much" seconds, even when the user locked the screen by the power button.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
but once the user presses the power button slightly, the CPU might still be working but your app is paused, thus you can't use any timer event you set. e.g: vibrate the phone every "so much" seconds, even when the user locked the screen by the power button.
I think that you can always use a service module for such purposes.
 
Upvote 0
Top