Jump to content
steve.b

ANDROID - How to create a folder in a USB stick and write some files in that folder

Recommended Posts

In my Android app, the user should have the possibility to save app configuration in a USB stick (and then restore that configuration if necessary).

I managed to open the app Files and select the root of the USB stick connected to the device.

I get the corresponding URI: "content://com.android.externalstorage.documents/tree/A8AC-5853%3A".

 

Now I have to create a subfolder and write in it two (xml) files but I don't know how to do.

 

I have found some Java code and some information in the Android Developers site but I'm not able to translate those information into some working delphi code.

Someone can give me some help?

 

Share this post


Link to post
5 hours ago, steve.b said:

I have found some Java code and some information in the Android Developers site but I'm not able to translate those information into some working delphi code.

Can you provide links to the code and information you're referring to?

Share this post


Link to post

@Dave Nottage

Here are some of the links I found:

https://medium.com/@vivekvashistha/how-to-save-a-file-in-shared-storage-location-in-android-13-c1e4fdf3d2cb

https://stackoverflow.com/questions/57570369/android-saf-uri-of-a-folder-on-disk-from-documentscontract-gettreedocumentid

https://github.com/emozgun/delphi-android-SAF/tree/main

https://stackoverflow.com/questions/68636036/how-to-create-a-subfolder-of-a-uri-folder-android-10

https://developer.android.com/training/data-storage/shared/documents-files?hl=it

 

Share this post


Link to post
2 hours ago, steve.b said:

Here are some of the links I found:

Given the content of the links, to create Delphi code for what you want to do does not seem trivial. 

Share this post


Link to post

It's certainly not a trivial thing for me. I'm not familiar with Delphi and even less with Android.
But it seems absurd to me that it's so complicated to create a folder on a USB stick and copy files into it in Android, in Windows it's definitely trivial.
I'm certainly not the only one who tried to do this, someone must have done it in Delphi (with less than 100 lines of code, I hope...).

I continue to search but unfortunately I have not yet found any concrete information.
My knowledge of Delphi and Android is limited and this does not make things easier.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×