Make Obsidian Sync work in background (on Mobile)

I’m not familiar with the details, but I think it has to do with what Apple allows apps to do in the background. AFAIK, since Obsidian uses Capacitor to build the mobile app, it would need to use web frameworks/services in the background in order to sync things in the background, and Apple currently disallows those frameworks from running in the background (and offers no way for the user to say “it’s cool I accept the risk/battery drain/whatever”).

It would be cool if Apple was less paternalistic about iOS. Alas.

3 Likes

Crap— of course. I knew Obsidian wasn’t native, but that implication didn’t occur to me. Thanks for the detail. I did a little digging just now, and it looks like there’s a plugin that might provide a way around that. It lets Capacitor apps run OS-native background tasks. Do you know if anyone at Obsidian has tried that?

I hope I’m not coming off as a backseat driver. :joy: Obsidian has been a game-changer for me, and this has been the only major hitch. If we know the Capacitor plugin won’t work, I need to see if I can find another creative solution. I have some ideas, but I don’t want to try something that the experts already know won’t work.

2 Likes

The team’s aware of Background Runner but it doesn’t solve all of the issues, regrettably. Open to other ideas as there’s always a chance we haven’t thought of it!

4 Likes

Thanks! That’s great to know. I’ll have to do some digging to see if my other idea has any merit. Cheers!

1 Like

I think this isn’t really viable but just dropping it here in case it could be relevant:

My hacky solution of playing a 10 hour silent audio file still works (as long as I don’t play other audio (spotify, youtube…) in between.
Note: only if the note that contains the audio file is in live preview, not reading view.
If the audio file in Obsidian would continue playing after the other audio source stops, that would be great - but technically not possible I guess.

I’m not sure which kinds of background processes prevent an app from being killed, but audio is one, and I guess location (e.g. Google Maps navigation) is another. I wonder if a plug-in that does constant location tracking as in a google maps navigation would keep Obsidian backgrounded. That could be a community plugin for those of us that want Obs backgrounded all the time.

4 Likes

I want to support the obsidian team because I love the product, and sync works GREAT for syncing my vault between computers, but it is very jarring to open up the mobile app, wait a few seconds for everything to load, and then wait again for files to update to their latest version from the cloud sync. Especially jarring with the daily note that gets opened by default.

It’s unfortunate that I can get a better user experience on Android using a third party syncing tool like Dropbox which does sync in the background.

4 Likes

There’s been a lot of discussion here about iOS. I’m on Android, and I’d be very interested on whether there’s the same limitations there. As I understand it there’s some existing capacity to function in the background on Android (I’m assuming so, as Syncthing does it at the cost of a constant notification telling me that it’s running in the background). Is it at all possible to implement this for Android users? I love Obsidian and want to support it, but it’s disappointing to see that the third party Syncthing solution is actually far more usable in this area.

Please let me know if there’s a better spot to be asking this, or whether this should be fielded as a separate feature request. Thank you!

+1 for iOS. I don’t know if it is better to reply here or create a new topic dedicated to iOS, it is my first post, so please be patient with me ;). I use Obsidian daily on Mac OS but not very often on mobile because

  1. Each time I want to send a piece of text or edit I need to wait for iCloud to synch (“Waiting for iCloud to synchronize Obsidian configuration files…”)
  2. it takes 1 to 5 minutes (sometimes more)
  3. On mobile the idea is to send a quick note to work on it later in desktop mode

So here is my question/suggestion :
On iOS you can decide to activate background updates for any application (if the feature is implemented) but I did not see the choice in iOS for Obsidian (Settings > General > Background App Refresh).
Could you add this feature for iOS: activate background Refresh ?

1 Like

Thank you for the information. But what is the situation for Android? I am using Android, but I am not sure if there is background synchronization.

I don’t know anything about Android except that you should be able to keep apps open in the background:

https://www.androidpolice.com/prevent-apps-from-sleeping-in-the-background-on-android/

Thank you for your response. However, being able to run an application in the background is different from the application having the ability to synchronize in the background. For example, I was using Joplin until recently, and Joplin did not have a background synchronization feature. It required keeping the phone screen on for synchronization, and there were even recommendations for specific apps for this purpose. I’m wondering if Obsidian has a similar situation.

I’m not a iOS developer but running in background means also receiving data. For instance, I have some apps syncing with feedly, for my rss sources, that sync in background, and fetch web content at same time, but the frequency depends from iOS and I know that there are some limitation but I don’t know which they are (in terms of computation time/data transferred in background).

I assume the average user would be ok if everythign needs to sync upon opening Obsidian. The waiting time until Obsidian opens is the annoying thing.
Over time it conditions you to use another app for quickly jotting something down, because 15s to a minute wait time is something most people are unwilling to invest for quickly jotting down a thought.

In my understanding, on mobile you cannot put application in background “as a whole”, as you do, for instance in Windows or macOS, since they will be suspended and they cannot be updated if you don’t declare and define a background task.

This task will be the part that could run in background, fetching data from internet and executing computation.

Since the task doesn’t run all the time but it is triggered with a frequency that depends from a lot of factors (like battery level, WiFi availability, previous executions, etc…) it could happen that you could open obsidian and the data inside has still to be aligned, since you did an update on another device in the time between two updates.

Anyway, declaring a background task for sync could be helpful to reduce the update time on opening since the refresh should involve only the very last data, instead of the whole package even if it could not remove the need of a sync “on start”.

I let skilled iOS devs to correct me. As I said, I’m not a developer but I just read some parts of the technical documentation so my understanding could be wrong.