Writing to external SD card in Android 5.0 and above

Yes.

When you create a folder in syncthing-android, you should see two entries in the folder picker list ending with /Android/data/com.nutomic.syncthingandroid/files. One points to a folder on the internal storage and the other one is a folder on the sd card. When you choose the sd card, you can create new folders there which are writable.

This solution, however, only works when the folder location doesn’t matter. You cannot use it to share data that was written to the sd card somewhere else by another app, like the DCIM folder.

1 Like

Hi, I want to ask what is the status of this problem? Is it solved? Or is there some recommended workaround?

I will be buying galaxy note 7, and synchronising content of whole SD card if essential part of my workflow. I have apps on android 6 that can read/write to whole sd card (Total Commander) so it is technically possible, right? I am willing to root the phone if it would help, but the informations here and on github seems to be a bit confusing
 samsung doesn’t support the merged storage
 so how can I sync the whole SD card please? Thanks.

You can only sync it read only / master by creating the .stfolder file yourself. It is still not possible to write to external SD, as (afaik) GO still does not support the File Access API needed in current Android versions (which e.g. Total Commander uses).

You can also use the merged storage feature, or whatever that is called.

samsung doesn’t support the merged storage


Also, I never found “merged” storage, but only a feature which replaces the internal storage with the external SD card. With that, Total Commander will only see the external SD Card and Pictures and the Android Data folder is always on teh external SD card. But apps can still save data on the internal storage and some apps will let you choose where to store the offline files.

Unfortunately Samsung doesnt support the merged storage on their phones.

This a major issue, is there really no way how to solve it? Is the GO android framework taking this seriously?

1 Like

It’s not possible, see the links in the FAQ.

Also, it works of you have root, and run Syncthing as rooted.

What I struggle to understand is why after two years after you opened the issue on golang github page, this is still not solved. Java apps can have read/write access to whole SD card, so it is technically possible. This cripples the whole Android-GO development and makes it hard to take GO as serious language/framework for Android development
 or am I missing something?

The idea to write the problematic part in Java, was discused on the issue page, but without any conclusion
 could this be the solution? How hard would it be
?

2 Likes

Go is taken seriously on Android, but nobody who cares enough about this specific problem, so nobody has invested any time into this. I guess the primary focus is things such as games and EGL apps which can get away without sd card access.

Writing the problematic part java is a lot of work, first, because you’d have to implement a fair amount of abstractions in syncthing to support some sort of bridge into java for a filesystem, as for now we use filesystem access provided by the stdlib, which sadly is not interface based so you’d end up having to reimplement a fair share of standard library for walking, globbing etc, etc.

Again, this is something it seems nobody is interested in investing time in, just because it’s a very very timeconsuming hack.

Since currently there is no way to provide external storage to the native binary, it won’t work unless Syncthing binary adds an API for providing external data, or most of Syncthing’s functionality is re-developed in Java. I don’t think this going to happen soon, so the more realistic scenario is that sooner or later Android Document Provider API is somehow supported in Go.

I don’t know how you could use Java for that. Youd’d have to call Java from Go, and I don’t think that is possible. Afaik the solution is using the NDK from Go.

Edit: Wtf everyone commented at the same time :smiley:

I did this on a Sony Xperia Z2 running Android 6.01, that is not rooted, to sync the pictures on the sdcard. I copied the file .stfolder from /storage/cardid/Android/data/com.nutomic.syncthingandroid/files/ to /storage/cardid/DCIM/Camera. Added a new folder to sync and selected the /storage/cardid/DCIM/Camera folder and it’s syncing right now to the server.

I recently got a Huawei P9 running 6.0, and syncing to and from SDcard works fine. I do not think it’s using Merged Storage, since the system settings show the SD card still as “portable storage”.

Sadly I do not remember exactly the process, but I remember authorizing something when I was using ES File Manager and attempted to copy something manually onto my SD card from the internal storage. It had me select my SD card through some system dialogue, and syncthing has worked since then without problem. Wish I had more info on why it worked, or if it would work with anyone else’s situation, but just glad it worked :slight_smile:

1 Like

Hello, I am currently on the Android version 0.8.4 (0.14.6) hornor 7 and android 6 I save all my sdcard I synchronize my nas with v0.14.9 version of Linux (ARM) everything works very well when I delete from my nas is also delete on my Android when I add photos to my nas that is added on my android (I do not understand the comment that you can not write on a sdcard aves synthing) Except for the Version 0.8.6 or 0.8.7 is the case, why chagnement what? Thank you in advance for your answers

bonjour, je suis actuellement sur la version android 0.8.4 (0.14.6) hornor 7 android 6 je sauvegarde tout sur ma sdcard que je synchronise sur mon nas avec la version v0.14.9, Linux (ARM) tout marche tres bien, quand je suprime depuis mon nas c’est aussi suprimĂ© sur mon android quand je rajoute des photos sur mon nas c’est ajoutĂ© sur mon android (je ne comprend pas les commentaire comme quoi on ne peut pas ecrire sur une sdcard aves synthing) Sauf que depuis la version 0.8.6 ou 0.8.7 c’est le cas , pourquoi ce chagnement que faire ? merci d’avance pour vos reponses

The only change in 0.8.6 is the folder picker, which doesn’t show folders on external storage devices any more. You can still select external devices if you enable the advanced folder picker in the app settings.

Thank you for the quick reply. I think it has to come from the android version that forcing others change. I’ll stay in Version 0.8.4

merci pour la rĂ©ponse rapide. je pense que ca doit venir de la version android qui a forcement d’autres changement. je vais rester sous la version 0.8.4

To allow UTG usb drive to be formatted as internal storage call this:

# adb shell sm set-force-adoptable true
1 Like

Is this something that is planned to be supported, as it seems a major flaw to be able to sync all our data?

It is not planned. My personal opinion is that any effort towards it is probably better spent improving a native Android solution like https://github.com/davide-imbriaco/a-sync-browser.

2 Likes