xiaomi seems to kill syncthing

Hi there

I have a quite weird situation here. I myself have a Xiaomi Redmi Note 8 Pro.

I’ve disabled the battery saving options for syncthing on my phone and it just seems to work and never dies.

On the phones of my Children I have the identical settings but it seems to be crashing there every now and then. Not sure if really crashing, but when I look at syncthing on my NAS, I just see their phones beeing disconnected for days. I then sometimes ask them to start syncthing, which results in the phones starting to connect and sync immediately.

Autostart of the app is also enabled…

Their phones are;

Xiaomi Poco X3

Xiaomi Redmi 9

Xiaomi Redmi 8

All phones are connected with the same syncthing endpoint(My NAS running on a raspberry pi 4b 8G)

Can anybody help me to understand what is happening and which log would actually prove anything? It’s quite annoying, and I’m frustrated because it happens on their phones, but not on mine…

I thought already if they are maybe doing something to provoke this behavior, but I have no idea what I am even looking for…

Thanks for any input:)

If it’s a problem with the rom, not sure we can help you much. You might be better of asking on the vendor forums.

Thanks for the comments. I hoped it would have been something obvious… Or even some human missbehavior.

I’ll try to check the logs on syncthing on one of the phones, trying to understand if the app is getting closed. It’s however quite hard to understand what happened when, as the log seems to be lacking of a timestamp. But even if there was, the log is very basic and if there is an external factor killing the app it would anyway not help much to understand what’s happening after all…

I kind of hate beeing in the dark without understanding what’s happening and no starting point of troubleshooting an issue.

I’m surprised, that there is not more people complaining about that… or maybe they knew where they should complain XD

One thing keeps me bugging though… I use the app Signal, my children as well… One has also to set the baterrysaver settings for this app to work properly… With Signal we don’t see this kind of behavior.

I have configured on the android app custom adresses as the phones are sometimes talking over a VPN to syncthing, not sure if this is a contributor…

I can’t stop thinking, that I’m(or we) are doing something wrong.

Anyway, if anybody has some additional comments, I’ll appreciate any ideas:)

Signal is probably implemented properly, using notification based apis which starts the app as messages come in.

Syncthing on android is implemented by taking the same binary you run on desktop, and running it as a subprocess of the android app.

1 Like

It’s not only Syncthing.

Xiaomi’s ROM (MIUI) is very aggressive when it comes to “optimise” and killing background apps. To make things worse, disabling their optimisation features doesn’t always fix the problem.

I have a Redmi Note 9S and Poco X3 NFC and the first thing I did was to unlock the bootloader and install a custom ROM. This creates other issues for some users (eg: if your banking app checks the safetynet status - which can also be “fixed” with Magisk) but for me the extra smoothness and apps working as they should are worth the downsides.

Using custom ROMs is not for everyone though.

Xiomi is a very good device as far as I know. Though I suggested my wife to buy a new one for her.

I’d hate to go down the route with the custom ROM’s. I’ve used them in the early days of adnroid because I wanted to use a hotspot and that was not part of the android build back then… It was not too good experiences as I remember, that it was quite unstable back then.

On this whole topic, By accident I’ve seen that my children play some games and then they open the app-overview screen(when you hit the square button on your screen) and click the X button to close down all open apps.

Now I’ve tried that on my phone and when you do that, it will also reset the syncthing notification, so my assumption is, that syncthing is getting killed. In the case of my phone it’s getting started up. But I could imagine, that this is part of the issue I see with their phones.

I’ve tried to experiment with a task-automation/scheduler, “Phone Scheduler”. The idea would be to at least start up Syncthing once an hour. On my phone it works, but that’s a bad measure since my phone also does not harm syncthing.

Anyway, when my children are back from the summercamp I’ll try to workaround it. I’ll update this thread with any progress I make or with any workaround, that I’ve applied.

Thanks a again for every single comment. I really appreciate any input, that has been submitted.

So I’ve tried the task scheduling app, with no real result… It seems that the app is likewise affected as syncthing itself, which makes actually sense.

I’m pretty sure other people will have sooner or later the same or a very similar issue, so I’m trying to think & understand what I could do to get syncthing forcefully started up… If that could be achieved in any way, it should be probably a small thing to have some small fix to the apk added…

Would anybody by any chance have some experience with some engineering on Android and could make suggestions or at least give some ideas what could be used to trick that mechanism? Some dummy messaging/hooks, to either keep the app alive or to start them up at some schedule… I agree, that this is not a pure Android problem, but rather the custom xiaomi rom, but there will be other manufacturers, that are doing same or a similar action, so I’m quite keen on trying to find a solution.

One thing I’ve discovered, the app doesn’t shut down when it’s actually doing something. Only if it is idle. Now that I’ve written this down, maybe a workaround could be to setup an empty dummy folder which get’s forcefully checked every 5 minutes?.. Not sure how bad it will affect the battery consumption, but maybe worth a test?..

Does anybody has an opinion?


Please forgive me if I missed the information, but do you want Syncthing to run in background all the time, or would only when charging suffice? Does the phone still kill the app when you set it to run only when charging?

If that is still the case, then you could try to enable the following.


This should prevent any battery saving mechanisms to trigger when the device is charging. Of course, the screen will stay on too, but you could enable a clock screen saver or something with minimum brightness to reduce potential wear of it.

That’s good input, I’ll experiment with those options as well.

The option with keeping the screen on would obviously be the least prefered as I would basically start to change the standard behaviour of the phone, and adding some complexity to the whole situation.

Thanks for that:)

Doesn’t Xiaomi allow to pin apps?

Hmm I think pinning the app might be the wrong word? If I google it, I find some instructions how to get the phone into a “kiosk-mode”(not sure if that’s also a term in English. It’s basically you select the apps, that are allowed on the phone and everything else is blocked)

Do you have some kind of example? I’d not know how where to set that up… there is one feature, which is I think called locking… You can go into the open apps overview(square button) and tap one the app, hold and select the lock symbol. Did you mean that one?

But honestly, I doubt, that this survives a reboot, will check though :slight_smile:

Yeah, that’s the one. This keeps your app alive even if your kids/wife close all apps.

1 Like

Ok, I tried the locking function. It survives a reboot, however on the phone I tested it closed the app regardless of the lock. Also my daughter was not on the phone, so it was not caused by anything she did.

The next thing I’ve tried was the dummy folder and set the scanning to 300 seconds. Currently it’s running (without getting killed) for around 3 hours.

I’ll monitor it to see if that’s already a convenient option to solve the problem.


Ok, I’ve now successfully used the option of creating a dummy folder with autoscan and scan every 300s. That does solve the issue. It’s not a very long testing timeframe I have to admit…

@AudriusButkevicius @bt90 In case it proves to be a sustainable solution, would you consider to built this into the app? (A dummy folder or a hidden folder, that is beeing scanned every 5 minutes. Maybe something like “androidscanfolder_do_not_delete”)

There’s certainly a use case; There’s a lot of people out there with no IT background and no engineering skills. It would be a pity if people would install the app, configure it, see that it doesn’t work the way they expect and then just delete the app.

Maybe you can think of an even more elegant solution to this behaviour, but since the binaries are the same on all plattforms I guess, that this is the most practical way with the least effort…

We are not going to add bandaids for some one funky vendor doing strange things.

1 Like

Xiaomi is happily killing apps which sadly works for a lot of them as they are either

  1. on a curated whitelist
  2. get triggered by the system using FCM (Signal and other messengers)

I agree with @AudriusButkevicius that we should not add crude workarounds to the app.

Maybe we should take a look and see if we can use the JobScheduler/WorkManager API instead of controlling Syncthings process lifecycle from within the app:

Ohh yeah… Probably the cleaner solution. What I proposed would have been probably more something like a tactical “fix”.

I know, that it’s apita, that vendors do some crazy things… And adapting to all of them would just be crazy… Even more funny, that they are not even consistent within the same brand(remember, my phone worked always without any trouble, while the other phones had this strange behavior)

Anyway I hope, that you’ll get some worthy solution into the package, and in the meantime I hope, that people will find this thread in case they find themselves in the same Situation.

Note that i don’t use the official app and therefore created the issue in the fork project.

1 Like