So I have been dealing with this for months, but it has just gotten worse and exhausting. I have to constantly restart Syncthing manually on Android 8.0, every now and then. And when I check back if a folder is synced, it’s just to notice that Syncthing had been killed (a few minutes/hours) before. So I am constantly restarting a service that is supposed to run on background, and it almost never keep running for more than 10 minutes.
When I disconnect from wifi and reconnect, it doesn’t start automatically in background anymore, like it did before. I even tried an automation app to start it when on a wifi, but it was a bit cumbersome.
Syncthing was running fine on Lollipop, started doing this on Nougat and got nearly unusable on Marshmallow. Don’t know how things will go on Android P.
I’ve double- or triple-checked all the settings: disabled battery optimization disabled on Android, tried every single settings combination on Syncthing (wifi only or not, charging only or not, background/foreground, experimental features etc.), to no avail.
I’d just like it to run continuously in background.
What phone and ROM are you using? There’s a chance that the manufacturer added some task killers that can’t be disabled. It would be possible to add some other methods in the app start itself, but I’m not sure how well that would work (using the JobScheduler API.
I know background processes can be one of the most problematic part of the mobile software development because of several reasons like the very limited resources.
I really appreciate your effort in developing syncthing.
Maybe you should check the ACR (Audio Call Recorder) Android application how it works because it works correctly on my phone for a long time.
Like Syncthing, ACR also has a notification popup on the top of the screen (sorry, I don’t know the correct name of it).
For ACR, I didn’t turned of battery optimization as I did for Syncthing to try to solve unexcepted exiting.
This bug seems to have nothing to do with Syncthing, rather with the couple OnePlus and Oreo. In fact, it has been an issue for a while in OxygenOS, but got worse with the Oreo upgrade.