I’m working on an Android app to be used in an experiment we are running in our lab. The application monitors the users movement using the accelerometers, performs calculations on this data at a regular interval, and writes the results to a file.
I’m currently having a very difficult time trying to find a way to run this process for the 15-20 minutes our trials require without it being killed. Despite declaring applications persistent, trying various service approaches (startForeground(), START_STICKY, ..), etc… I cannot seem to keep the Android OS from deciding to pause or kill my service/process.
I’ve done some research and the only advice I can find is how to set up your processes to gracefully recover from being killed, however I cannot afford to have gaps in my data and therefore need this process to run continuously.
Could someone point me in the right direction?
The best solution I could come up with for my problem is increasing the screen sleep delay on the device to 30 minutes and pray no buttons were pressed during our trials.