Writing to external SD card in Android 5.0 and above

Android 5.0 and above supports writing to an external SD card, but requires that the user select the allowed directory. Syncthing for Android 0.5.28 doesn’t seem to support this. Are there any plans to add support for this in the near future?


Afaik, this access must go through Storage Access Framework.

The problem with that is it uses special URIs to access files, and golang does not support that (at least that’s what @calmh said a few months ago). Maybe support for this will come when there is full Android support?

If it doesn’t exist, perhaps I should post a bounty to encourage creation of it?


The first step would be to open an issue at golang, and see where it goes from there.

Thank you. Would you have any pointers to where I can do this?


I’ve gone ahead and posted a bounty for this:


I went ahead and opened an issue at golang. Let’s see where that goes.

A colleague just pointed me at this issue. What’s the problem exactly? I see in the code that the manifest has: It also needs the READ_* permission likely. That should give it full access to external storage. Storage Access Framework is a completely different system for interacting with user documents across apps, has nothing specifically to do with write access to sdcard.

And you’ve always needed that permission to read/write sdcard without root. Old apps didn’t have it. The change in KK is that you can now read/write to your private data folder on sdcard WITHOUT needing the permission – you only need it if you want to touch outside your private data.

So is the real problem that syncthing doesn’t USE external storage (sounds confusing, but it only has the WRITE permission), doesn’t expose it to the user as a target, or is there simply a bug under the hood somewhere…

Hope that helps!

Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission.

The problem is described here. tl;dr you can only write to some folders now (unless a custom rom changes this)

Will rooting the device override this lunacy?

1 Like

There will be an option to run Syncthing as root in 0.6.2 :wink:

1 Like

Nice. Thanks.

Is anyone interested in working on this?

I’ve upated my Z3 (not rooted) to Marshmallow, formatted the SD card as ext4 and it’s now seen as internal storage. Syncthing can now read and write from the SD card with no restrictions.

Formatted it how?

Found this steps with a quick seach on google:

Go to “settings” -> “Storage & USB” -> “External SD Card” and select “Erase & Format”. There you should be able to select “use as internel storage”.

I don’t have an Android 6.0 device with SD-Card, so I did not test this.

Can’t remember now as it came up when i flashed Marshmallow. But I’m sure it was under Settings > Storage & USB

Hi everyone! 
I think i solved problem.
Here what you need:
2. Xposed framework
3. HandleExternalStorage module for Xposed
Install all this, and THEN enable root in syncthing.

The problem with that is it uses special URIs to access files, and golang does not support that

Would it be possible to workaround this by shipping a small part of code (or even a separate app) written in e.g. Java (?) that handles storing of files? (I don’t know anything about programming for Android).

1 Like