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
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.
Before we start: External storage means a real sd card or a connected mass storage USB device. This class can also be used to access the secondary storage (File.DirRootExternal). This becomes relevant with newer versions of Android that restrict direct access. It has nothing to do with runtime...
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.
TextEditor is an example that uses ContentChooser to load files, SaveAs code to save files and some other useful features.
ContentChooser and SaveAs work with any type of file.
Thank you all.
Erel I have already tested Save As on Android 11 but it does not display the Android / data folder for the user to select to save the file.
Google seems intent on dumbing down Android to the point of uselessnes to me. I think of my devices as little computers and I want a proper file system on them, not the limited tortuous things that Google offers and that I don't understand, ContentChooser, FileProvider, ... o_O I'm getting old...
I don't know. As I said it might be possible using the ExternalSotrage class but I haven't tried it. Rather than try to buck the system I would find another way, Android security is just going to get tighter as time goes by.