Make Obsidian Sync work in background (on Mobile)

I don’t think push based syncing will help the mobile app finish uploading changes after the app has been quit. This is a case where the only viable solution may be iCloud-based syncing, unless Obsidian Sync can be updated to use URLSessionConfiguration.background or BGProcessingTask.

This doesn’t help the main case of using the app on a phone without worrying about Sync, but on iPadOS 26 it seems that windowed apps are considered active even when not currently focused, so Sync will still work when Obsidian is (for example) hidden behind 2 other windows. Baby steps!

1 Like

Hello!

Push based sync could trigger the app to launch in the background. The app should then simply check what needs to be synced and launch a short process to upload/download what’s needed.

Done right, it should work. ENTE is an alternative to Google Photos, the whole point for them is to upload pictures as frequently as possible.

The app is still at the mercy of any changes from Apple’s side, but that looks like a promising, Omni is another example that it seems doable.

Windowed = a program open in iPadOS, but not currently the one in focus / being displayed ?

Does the depth of window matter ?

If Obsidian is behind 3 other windows … then it won’t sync ?

Has this been confirmed to work with iPadOS 26 and NOT iOS 26 ?

Windowed means you’re using iPadOS’s “Windowed Apps” or “Stage Manager” mode and the app isn’t in full screen mode. IOS doesn’t have these modes. I don’t know if the depth matters but I would guess not. There may be a limit to how many windows can be open (perhaps dependent on how much RAM the device has), but if so it’s more windows than I’m likely to have open.

1 Like

I think this pretty fundamental core functionality for syncing, that most people (including myself) expected. I understand it’s not trivial given the constraints, but that doesn’t mean it’s impossible to improve the situation. I doubt that anyone pays for sync without expecting to use it on multiple machines. Not familiar with Apple’s APIs, but there can’t be some native part of the app running in a separate thread that could continue to run for syncing? Most syncs are short. And if one is too long and gets killed by the OS, then it could just be rolled back or not committed on the server or something? Just saying, there have to be options here.

This is very important for me and my main use case for syncing. I often need to wait a minute before I can even use the app on mobile such that my notes sync. It’s just not a good experience without background sync. It is definitely possible on Android.

I was thinking about this again, and while I still think that background sync should be a thing, a huge pain point could be helped by just moving the sync status to the main part of the gui, instead of in the sidebar. That would at least give a constant visual indicator of when the app needs to be left open. It’s a small thing, but I suspect that it would be easy to implement and therefore have a good bang to buck ratio. Apologies if somebody already suggested something like this.

Here is the feature request for that, where you can add your feedback or press the heart button: [Mobile] Make Sync icon always visible. It also includes a CSS snippet workaround to make the status visible.

1 Like

Now that we have Obsidian shortcuts in mobile app, would it be possible to add a new action to Force Sync? My use case would be the append text to a note then force sync so that it’s available everywhere without having to open the Obsidian mobile app.

1 Like

I think there are two different things being discussed here:

  1. Syncing updates from other devices to mobile (download)
  2. Finishing sync of what you just typed in the mobile (upload), even if you switch to another app or go to home screen (as reported by robertd5, remmah, and PierrickB, to my understanding)

Make Obsidian Sync work in background (on Mobile) - #97 by CawlinTeffid seems to be about #1, and I understand that it’s not trivial.

But #2 seems to be a different issue entirely, where what you typed into the app fails to complete syncing when you switch away from the Obsidian app too fast.

For those who are here for #2, you may want to check if your symptoms look like this reported bug: Sync not pushing full update

1 Like

To my disappointment, it looks like #2 just got closed as it’s “working as intended.”

I.e., if your mobile usage involves switching apps or locking your phone after typing, you may have to consider alternatives.

2 Likes

I’d argue that the two of those are pretty closely related. If you want it to sync, then you very likely want it to sync both ways. Also, a solution for one will likely involve solving the other. So I don’t think it’s too useful to decouple them into separate discussions.

That said, the second (uploading) tends to be the more common problem for me. Regardless, this has become my workflow:

  • Open the app.
  • Swipe to open the sidebar.
  • Wait until sync completes.
  • If a plugin needs an update, do that, kill the app, and start over.
  • Make the edits that I wanted to make.
  • Swipe to open the sidebar again.
  • Wait until sync completes.
  • Switch apps, lock the phone, etc.
1 Like

They are related in the sense that they both regard sync, but they differ a lot in the effort required to implement.

#1, as mentioned by @CawlinTeffid, requires long-running background tasks which has complex requirements, and is expectedly rather an uncommon pattern in other content management apps. Notion or Google Keeps for example don’t do such, and instead download the contents of a note when the user navigates to it.

#2, on the other hand, is a common pattern among apps that require syncing, and is relatively more convenient to implement as Apple has a different API that specifically calls out for the exact purpose:

Call this method when leaving a task unfinished might be detrimental to your app’s user experience. For example, call this method before writing data to a file to prevent the system from suspending your app while the operation is in progress.

The said API provides 5 seconds of execution after the app goes to background, which can’t be used for downloads in #1, but is ample for uploads in #2 for sending the final characters which the user has just typed in.

1 Like

Ok, that makes a lot of sense. Thanks for clarifying! The second case would be more helpful for me too, because that’s when I forget to wait for the sync.

1 Like

I understand the extra effort of creating reliable background sync on mobile.

But the original post in this thread makes the following suggestion:

(Possibly simplest?) Expose an intent/activity, which I could then hook into using Tasker. So I would implement my own cron job with Tasker that would just use the hook.

I haven’t seen this addressed…

This requires zero sync code/architecture. It’s just a exposing an intent, a pretty basic feature of android apps. Or on iOS, an app Shortcut.

Then other third party tools like Tasker/Siri/whatever can be used to trigger sync when the user wants it.

1 Like

Hello Friends,
I was searching a solution for this problem too and think that I might found a solution using obsidian sync on android! I basically used Termux to use Fedora to use headless sync. Here is what I did (summarized by a LLM):

  1. Install Termux & Fedora-Proot

    • Install Termux from F-Droid or Play Store

    • Install proot-distro and set up Fedora:

      pkg install proot-distro
      proot-distro install fedora
      proot-distro login fedora
      
  2. Install Node.js & Obsidian CLI

    • Inside Fedora:

      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
      source ~/.bashrc
      nvm install 22
      npm install -g obsidian-headless
      
    • or just run sudo dnf install nodejs

  3. Prepare a Vault on Shared Storage

    • Use Android internal storage accessible to Termux:

      termux-setup-storage
      mkdir -p ~/storage/shared/Obsidian/MyVault
      
    • Move or create your vault in this location

    • This makes it accessible to Termux, Fedora-Proot, and MTP for PC

  4. Map Shared Storage in Fedora-Proot

    • Create a symlink for easy access:

      mkdir -p ~/storage
      ln -s /data/data/com.termux/files/home/storage ~/storage
      cd ~/storage/shared/Obsidian/MyVault
      
  5. Start Headless Sync

    • Export your Obsidian Sync token (optional – you can also just login with ur username and passwort and 2fa key)

      export OBSIDIAN_AUTH_TOKEN="YOUR_TOKEN_HERE"
      
    • Run Headless in continuous mode:

      ob sync --continuous
      
  6. Optional: Automate on Boot (didn’t try this step yet)

    • Use Termux:Boot to run a script at device startup:

      mkdir -p ~/.termux/boot/
      cp ~/start-obsidian-sync.sh ~/.termux/boot/
      
    • Script example:

      #!/bin/bash
      cd ~/storage/shared/Obsidian/MyVault
      export OBSIDIAN_AUTH_TOKEN="YOUR_TOKEN_HERE"
      ob sync --continuous
      

I did everything except step 6 but will try it out in the next days. You might want to try this too since it could be a handy solution and there is more experience needed to confirm this

3 Likes

And I forgot to mention: Exclude “?” from your filenames bc it will cause problems with sync

Here are the battery usage results after 9,5h of usage (less than 1% additional drain during that time).

1 Like

This continues to be one of my biggest pet peeves on iOS and macOS with obsidian. It feels like support is absent in working together with the wishes of their paying customers.

A background intent would be great such that I can use shortcuts to trigger a sync and to have that complete if I modify something outside of the app but within my vault. As a workaround or interim step in my eyes.

I am considering cancelling my sync membership to instead use iCloud based syncing as I am in the Apple ecosystem. It’s a shame that it doesn’t just work. Fundamental is definitely what I’d describe this feature to be.