Android Question any way to prevent Android from pausing a process

f0raster0

Well-Known Member
Licensed User
Longtime User
Our App is running almost 24/7 connecting to the server.
screen on all the time.

When the user don't do anything in a long time, example, ~60min the App fail connecting to the server, until we reset the App.
When the user is active using the App, all OK

It looks to me Android is pausing process when the Tablet is not used (or screen not touched)

Any way to prevent Android from pausing a process?

thanks for any idea
 

f0raster0

Well-Known Member
Licensed User
Longtime User
foreground and asking to the server every 10sec

All Ok if the user is using the App often (touching the screen)

will try to create a small App with the problem.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Insert in your code:
B4X:
'No standby
Dim nowake As PhoneWakeState
nowake.KeepAlive(True)

So the device doesn't pause
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Good question. The watchdog has a foreground service. The device itself is never sleeping because the main app keeps the screen turns on.

The watchdog app is small and simple enough to run "forever" without any issues. If there were any issues then the main app can periodically start it with an intent. Nothing happens if the target app is already running.
 
Upvote 0

Bob Spielen

Active Member
Licensed User
Good question. The watchdog has a foreground service. The device itself is never sleeping because the main app keeps the screen turns on.

The watchdog app is small and simple enough to run "forever" without any issues. If there were any issues then the main app can periodically start it with an intent. Nothing happens if the target app is already running.

Could you pls send an example?
Thanks in advance..
 
Upvote 0
Top