Prevent stand by

magarcan

Active Member
Licensed User
Longtime User
Hi! I'm using a timer that show different things in my windows, but after a few time, my phone goes to stand by state. I've used KeepAlive(True), but it is not working. Any idea??

Thanks!!!
 

magarcan

Active Member
Licensed User
Longtime User
B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim timer1 As Timer'Frecuencia
   Dim pws As PhoneWakeState'Prevenir el ahorro de energía
End Sub


Sub Activity_Create(FirstTime As Boolean)
      p.SetScreenBrightness(1)
      pws.KeepAlive(True)
      Timer1.Initialize("timer1", main.frecuencia)'Frecuencia
      Timer1.Enabled = True
   
End Sub
I think so.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code looks correct, though it is better to change it to:
B4X:
If FirstTime Then
 p.SetScreenBrightness(1)
 pws.KeepAlive(True)
 Timer1.Initialize("timer1", main.frecuencia)'Frecuencia
 Timer1.Enabled = True
End If

How long does it take to the screen to go to sleep? Which device are you using?
Also check the unfiltered logs.
 
Upvote 0
Top