2

pretext: as gmail no longer allows me to send zip files, i have been looking into other ways to get my java source directories from android to laptop and back again, depending whether I'm at home or not (folder hierarchy must be preserved). I have been trying to set up git on my android phone and have been using termux as the command shell to do this.

the problem: I am unable to create a directory for which BOTH termux and the java ide have read write access. I have setup storage permissions in termux. If the IDE can write termux can't, and in another location termux can write but the IDE can't.

What I need is a folder location that both apps have full read write permissions. (I am not too bothered if these permissions extent to other folders)

I do not want to root my device.

Nokia 7.2 Android 10

2
  • 2
    Apps cannot access other apps' private directories: Where Android apps store data?. All apps with Storage permission can access external shared storage (though subject to some restrictions since Android 10 and 11): How do I access $HOME/storage outside of Termux?. But the shared storage is a permission-less emulated filesystem: What is /storage/emulated/0/?. So you cannot retain files' ownership, mode etc. Root gives multiple options. Feb 21, 2021 at 15:36
  • Have you tried /data/local/tmp that is the only option outside of the sdcard folder? How about running an git server in termux? If your IDE can handle local GIT repos a remote repo on 127.0.0.1 should be possible, too. You even have two options, git via http or ssh. Of course this would require to have the git repo twice on Android.
    – Robert
    Feb 21, 2021 at 16:49

3 Answers 3

0

Now here is a "so simple a caveman could do it" solution to your main problem, not related to any of the git /termux stuff you have mentioned.

If you use Windows, There is a piece of software called Feem (https://feem.io/) which allows you send files over devices on the same network. Afaik, it should work on windows 7 and up. It definitely works on 10. If you use linux, use KDE Connect. Basically the same thing.

These are manual transfer tools, ie: you have to send the file manually again if you edit it later on.

Also you will have to compress everything and then transfer the compressed file because these tools can't seem to be able to recursively transfer complete folders while they perform well with compressed files.

You could also try syncthing (https://syncthing.net/) if you want a continuous backup kind of system between your android and pc. If you make any changes, these will be reflected on your device depending on how you setup the sync. Just have both devices on the same network with syncthing running on both devices and the sync will be done. BTW, syncthing is cross-platform.

SyncThing should be the best solution to your problem as you won't even have to compress the folders and sub-folders to preserve hierarchy. Syncthing recursively includes all folders and sub-folders while syncing.

Of the tools I have mentioned, Feem is not Free software(as in libre, not gratis) while the other tools are, to the best of my knowledge.

This is my first answer here so please give me some constructive feedback on how I can improve my answers.

0

some file explorers let you see termuxes storage as a drive in someway. you could just transfer the files to your phone from your pc and then use a file explorer to transfer. if you want https://wiki.termux.com/wiki/Internal_and_external_storage

1
  • Unfortunately i cannot connect the two devices directly. but if i could that would solve the initial problem ( although does not answer the question asked). Furthermore i could even write a small script to compress the parent directory (at known fixed location, copy to destination, and extract), the equivalent converse could also be written (or even signalled with a boolean argument). (or even source and destination arguments). If anyone needs the appropriate .sh or .bat script let me know and i will post it.
    – MrOtto
    Feb 24, 2021 at 10:06
0

I have achieved a solution by making the project folder in the main storage (/emulated/0/ProjectName) instead of on the sd card. In termux i navigated to (...ProjectName/src/com/package/) and ran 'mkdir test'. In the ide i then created 'test.txt' in the newly made test directory. This all worked fine, although i have not linked git to this directory it proves that write access is there for both apps.

Before i was attempting to use a folder in the sd card which would not allow the permissions. I did not change anything else regarding settings and permissions between these two attempts, but some were changed prior to the initial attempt in the sd card, which may have played a role. If you are having the same issue feel free to comment and i will go through all other settings i changed before this. or maybe someone with better knowledge of android can comment as to why this worked.

edit: quote: "Some phones prevent third party apps from accessing the sd card but with the appropriate permissions all apps can access the internal storage."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .