Is it able to access external card via Android NDK ?
It should be a simple task to implement go wrapper over C++ (NDK) code. I think porting syncthing to android was much more harder to do.
Is it able to access external card via Android NDK ?
It should be a simple task to implement go wrapper over C++ (NDK) code. I think porting syncthing to android was much more harder to do.
The issue talks about accessing internal storage which we donât have problems accessing. It states that you only needs permissions to access external storage, which was perhaps true in 2012, but is no longer true.
Will not insist, as Iâm not Android programmer, seems this restriction is done in Dalik/ARM virtual machine, not by Linux kernel/SELinux. At least, I can do âshell@E5333:/storage/sdcard1 $ echo > aâ from shell. I belive, utilities like âechoâ and even Dalvi/ARM are build with Adnoid NDK, and they have write ablity to external sd. Itâs just an opinion, sorry if Iâm wrong.
Thanks, it works! And I also found out the updates on the manifest file will only take effect after you re-install the app. 2015-06-16
Well, compile a Go binary and see if you can get a go binary to do that without root.
As with all things Android I expect there is variation between ROMs. Maybe yours doesnât enforce this. Iâm pretty sure other variants do, or this issue would have been a non issue. Thereâs also no indication the comment you quote relates to 5.0+. The rest of the post predates 5.0 by years.
Hi all, I read through the entire thing and wanted to add that I was also able to get it to sync to my SD card without rooting my device or adding the card as internal or adopted. Below will be to add my experience after following the steps of the post from AnnoyingDuck in December 2017. Also ran using the WebGui where possible as advised by Cooad in April 2017 on this thread.
My Phone: Moto G5S plus Running Android 7.1.1 Not Rooted SD card is formatted as external, havenât done anything besides put it in my phone.
Followed Steps 1, 2 and 3 from AnnoyingDuckâs post with no problem. I opted to not have my phone and computer sync just yet though, and instead wanted to test making a folder on my external SD card via SyncThing. As Annoyingduck said you do want to use the Advanced Folder Picker option.
When I went add the folder Syncthing gave me the warning: Android version does not allow syncing to external SD card etc. but somehow after plugging that path in a couple times, it was suddenly an option in the list of possible paths when I backed out and tried to create a folder again.
I chose the SD card option, named the folder Music (which matched the Music folder I had set up to sync on my computer). Went back to my computer, told it to share the folder with my phone, received the request. I guess since the names of the files were both music it just recognized that was where it was supposed to go so it started syncing the computer to the folder Iâd created.
In case you arenât extremely technical and have no idea where to get your SD file path from, an app I had used in the past called OneSync (used to sync OneDrive) showed it. So I redownloaded that and wrote down my file path.
Sorry if thatâs a lot, Iâm not very technically savy, I just hoped this would help others like me who donât know much beyond how to follow instructions found on the internet to a certain degree.
On my device Sony Xperia Z3 compact with Android 6.0.1 I test Syncthing Android v1.1.0 from Google Play Store.
If I use a path like /storage/0000-0000/Test/Syncthing, when I try to change âFolder Typeâ I receive this message âYour Android versiononly grants Syncthing readonly access to the selected folderâ. But I see that Syncthing create the â.stfolderâ, so it can write to the SD card to crate â.stfolderâ.
I set up the the folder to sync to PC. I set up by web interface the folder as âSend&Receiveâ. When it try to sync reply, all file are in status â⌠acces deniedâ, and it canât sync file.
I thing you may investigate on why â.stfolderâ can create, but the other file and folder not.
Bye
The explanation is in there:
This is the only thing that keeps me from using Syncthing everywhere. It is USELESS on an Android phone. It is also NOT an Android problem as I have many apps on my Android 8 un-rooted phone that can write to ANY folder on my SD card. It is due to the fact that Syncthing is written in GO and GO cannot request correct permissions on Android. There are no DEVs that want to write an Android client in another language (Java?) that can request permissions correctly. None of this is meant to talk down about anyone. I just wish it wouldnât be stated that this is because of âAndroid restrictionsâ It is because of Android permissions that Syncthing cannot access.
To me the second sentence immediately invalidates the first: Android imposes restrictive permissions, which prevent not only Go/Syncthing, but any program from directly accessing the files, instead needed to access that through an Android API. This is a restriction by Android - whether you consider it a good one or not is another question and quite irrelevant.
This is misunderstood âtop1â. Iâve switched all our phones at home to official unrooted Android meanwhilst and the ones having an sdcard can write to it using Syncthing. You just have to use the special folder the app suggests to you when creating a new one on Android and your write access is there.
@Catfriend1 Well, Iâm inclined to note, that you talk about sightly different things. You will spot the difference, if you try to sync the DCIM folder (or some arbitrary other folder outside of âAndroid/data/com.nutomic.syncthingandroidâ) on your SD card.
Being on Xiaomi mi8, I can sync /storage/emulated/0/DCIM with readwrite. I even have full access to /storage/emulated/0 and sync that in both directions. On sdcard, /DCIM is read only, so thatâs where I think your statement fully applies.
@Catfriend1 Exactly. And given that older phones at least are space constraint, hence relocating DCIM to the SD card is a very common operation. Syncing this folder would give a beautiful workflow: delete unwanted pics and relocate valuable pics to different folders on the PC, and a sync would clean up DCIM automatically. IF only Google wouldnât be such a PITA.
Google donât care about DCIM on SD cards, because their phones donât have a SD card slot. For (about) the same reasons, they prioritize GO language extensions, that donât buy them muchâŚ
Of course, advanced users could use this pattern much more widespread: I used to sync ebooks, mp3, business docs, source code, but the whole SAF disaster spoils the fun, and syncthing (usage) is the victim.
Given, that typical folders in emulated (builtin) storage donât need the SAF, the whole security blather is pretextual for their own advantage.
In fact, using syncthing on portable devices has some other trade offs (energy-wise), but this very issue is enough to not even care/report about the other issues, because it broadly limits syncthingâs usefulness on such devises.
Iâm back to oldschool cutânâpaste on a case by case base, because of this at least (while Iâm using syncthing successfully in many other use cases, btw).
To make external sd card access, syncthing-android should move from syncthing binary to syncthing library with extended api to call file IOâs. gomobile build should be a build utility. Iâve done for android torrent using torrent go library.
Sure, thatâs what should happen, sadly nobody has enough time, ambition or knowledge to do this.
This is quite a shame, itâs the one thing holding me back from being able to completely switch from Resilio Sync. Dammit google.
As I understand it, the two primary proposed solutions to this point are:
Implement syncthing natively in Java/Kotlin and use SAF to prompt the user for access to the SD root, and to access files and directories.
Create a thin layer in Java/Kotlin which uses SAF, and use some sort of socket or pipe protocol to interface with that layer from Go.
Unfortunately, from watching this video (relevant part linked, but the whole thing is very informative): https://youtu.be/UnJ3amzJM94?t=1193
It appears to me that neither approach will yield a solution, because GOOG explicitly does not want people using SAF for broad file access. I think the only solution is getting approval for âAll files accessâ, which according to the video doesnât sound very easy. I do think thereâs a good chance syncthing could qualify though.
Whatâs worse, Iâm pretty sure these issues arenât just going to affect SD cards. If I understand correctly, these enforcements are coming to internal/external storage as well. Am I missing anything?
I used sync thing at Android 9 (MIUI Version) and was surprised hat the SD-Card problem was gone. Why worked it at android 9?
Thought hat this problem was solved with android 9, but since the todays upgrade to android 10, I can not sync to the android device again.
In MIUI is no option to format the sd as internal storage ?
There is no other way to fix it currently?
No, there is no workaround.