Android: A started synchronization should finish, even if the app is in the background

Hello!

I recently noticed that once a synchronization has started, it only finishes if Joplin is in the foreground (the currently active app).

Let me explain:

  1. Start the Joplin Android app (synchronization starts automatically)
  2. After a few seconds open up any other app before the synchronization is done
  3. Go back to Joplin and see that the before started synchronization was stuck while the app was in the background

Almost every time I open up Joplin on Android I see something like 4219s in the lower left corner. In my opinion, a started synchronization should finish and not halt only because Joplin is in the background. I didn't cancel it, so I expect it to finish. Synchronization can take a long time, and I don't want to wait for it to finish before I can open up another app.

This should be something Android is easily capable of. It's just an idea, but I think it would be a nice addition to the app and increase UX noticeably :slight_smile:

Have a nice day.

Its a well known and old issue/limitation seemingly related to react-native. Only real workaround for the moment are to use a "keep awake" app or similar built in function on the phone.

I feel this can be accomplished using Headless JS as provided by RN. It can be used to run tasks in JavaScript while app is in the background.
Alternatively BackgroundFetch by expo-background-fetch can be used with TaskManager native API for pushing sync in the background.

Yeah, it can technically be done, it's just extremely non-trivial