Android Question Copy the file to the Android/data folder

Hi
I have been researching for a long time to be able to copy a file (folder) from dirinternal in the android / data folder. This is easily possible with file.copy in Android 10 below, but in newer versions of Android (some Android 10 and Android 11) it is very difficult and complicated. So I thought it would be impossible to work with this folder in Android 11 anymore. But today I installed the zarchiver program and to my surprise I was able to copy the file to the android / data folder. This app first directed me to the android / data folder and got permission to use the folder.
So we can definitely get permission to use this folder in b4a and then copy a file into it or delete a file.

You can test zarchiver yourself in Android 11 by installing it and then going to the zarchiver folder and copying a file into it.

I ask Erel and the other respected programmers to guide me. I really need to work with the android / data folder on newer Androids.
Thankful
 

drgottjr

Expert
Licensed User
Longtime User
read this thoroughly. and if you're thinking about listing your app on play, forget it.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
But today I installed the zarchiver program and to my surprise I was able to copy the file to the android / data folder. This app first directed me to the android / data folder and got permission to use the folder.
That is a hack using ExternalStorage that is currently used by several file management programs to access the Android folder. It is a bug/feature that Google did not intend to exist and it may be closed in the near future. You could try to replicate that behaviour with the ExternalStorage class.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Use SaveAs and let the user choose the target:
What I am still puzzled about is the link that Erel suggested is relevant to text files. How do you know the OP wants to copy a text file. What if he wants to copy say, a SQLite file from internal to another folder, that link is no longer relevant because you cannot open a db file using a text editor. Isn't the link to text editor misleading in post #3.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Nope. See post #5 in that topic
 
Upvote 0
Top