Trouble keeping an application running in the background
-
Hello, I am trying to make an app that runs even when it is not in the foreground. My host machine is Windows 64-bit and target is Android 9 mobile phone.
What I am expecting:
Application needs to run some algorithms that needs real-time operation without any performance limits. Also it should also let an another app be active.What happens:
Application terminates after some other application stays active and/or receives user input. No errors thrown. No set time to make this happen. Not always happens. Seems I cannot escape Android optimization.What I tried:
-Modified my AndroidManifest.xml as follows:
<meta-data android:name="android.app.background_running" android:value="true"/>I keep track of the application state and do not update any windows when it is not active
-Disabled battery optimization for my app
-Tried to increase background app limit(4 was the maximum default was "standard")
Documentation states that background services have some limitations regarding system resources. Is there a way to make this work with current configuration or do I have to try to convert this to a service? I need to use hotspot, Bluetooth and mobile connections for this app.