Android App. Timers and Processes Stopping in Background

Hello everyone,

I am currently developing an app for Android using Xojo. Unfortunately, I’ve encountered a problem where the app’s timers stop, and all processes cease when the app goes into the background after a few minutes.

It seems that the app is not able to continue running in the background. Has anyone else experienced this issue? How can I grant the necessary permissions to ensure that my Android application continues to function even when it is not in the foreground?

Any guidance or suggestions would be greatly appreciated. Thank you in advance for your help!

What are you trying to do in the background? Typically you want to not depend on timers firing, instead use the activate and deactivate events to resync/resume. Maybe for a download you could continue in the background but that should end soon to let the phone save power

With the timer, I execute a JavaScript every 15 seconds using ExecuteJavaScript in the MobileHTMLViewer, but it gets paused after a few minutes.

Things like that chew battery on mobile phones. They’re discouraged, thus the app needs elevated privileges to continue to run in the background. Apple have rules for the type of thing that can be done in a background app. I’m aware that you are on Android, but the principals are similar. What is it you are trying to achieve with the javascript.

4 Likes

I have the same problem trying to achieve what the OP is trying to do.
There are works that needs to be done continuously ( we are monitoring the movement of the phone via phone’s GPS at all time, where the phone is continuously updating its location every 1 minute).
But once it is in the background, all process is halted for now. Is there any ways to enable background processing of the Android app.

I am aware that there are limitation to the design principle, but not all cases are same and i believe for some cases there are valid reason for the exceptions.

It would be worth you looking at this:

and: