Android Question Copy a file directly to the SD Card unattended

Jose Cuevas

Member
Licensed User
Longtime User
Hello friends, according to my device, this is the directory of the SD card (/storage/47F0-1803 or content://com.android.externalstorage.documents/tree/47F0-1803%3A) and I want to directly copy a file as a backup inside the SD card. But the examples that I have found (For example ExternalStorage Class), it is necessary for the user to manually select the destination directory, but I need to do it unattended.

Maybe the user can select once the destination directory (As a initial configure), store it somewhere as a value, and then make the copy using the stored value.

Thank you very much in advance for any help you can give me.

Regards,
 

agraham

Expert
Licensed User
Longtime User
Maybe the user can select once the destination directory (As a initial configure), store it somewhere as a value
That's exactly what the ExternalStorage class does. The user only needs to select the SD card once.
 
Upvote 1

Jose Cuevas

Member
Licensed User
Longtime User
Hi agraham, the selection remains as long the app is running, if the app is closed or the device is rebooted, the user have to select the destination again.

Is there a way to capture the destination directory in order to store it in a database or something?
 
Upvote 0

Jose Cuevas

Member
Licensed User
Longtime User
Thanks Erel, I already understood, the trick is to always execute Storage.SelectDir(True), if a directory has not been selected, it prompts the user to select the directory and if it has already been selected, it does not stop to select the directory again and takes the last selected directory.
 
Upvote 0
Top