Sergey_New Well-Known Member Licensed User Longtime User Feb 27, 2025 #1 As I understand, in this case the app can't access the Download folder. For the app to work, the user must place their files in this folder. How to avoid violating Google's requirements? It's strange that the device's file manager has access to the Download folder. I need to copy files from there to the folder created by the app.
As I understand, in this case the app can't access the Download folder. For the app to work, the user must place their files in this folder. How to avoid violating Google's requirements? It's strange that the device's file manager has access to the Download folder. I need to copy files from there to the folder created by the app.
DonManfred Expert Licensed User Longtime User Feb 27, 2025 #2 Sergey_New said: How to avoid violating Google's requirements? Click to expand... Simple. Do not publish Apps Sorry, i couldn´t resist. The Access to the Downloadsfolder is Restricted. You can access the files using ContentChooser but not directly. Search the forum for examples on how to use ContentChooser Upvote 0
Sergey_New said: How to avoid violating Google's requirements? Click to expand... Simple. Do not publish Apps Sorry, i couldn´t resist. The Access to the Downloadsfolder is Restricted. You can access the files using ContentChooser but not directly. Search the forum for examples on how to use ContentChooser
Sergey_New Well-Known Member Licensed User Longtime User Feb 27, 2025 #3 DonManfred said: Simple. Do not publish Apps Click to expand... Why does the device's file manager have access to the Download folder? Tried using ContentChooser, but the app was rejected in AppGallery and RuStore. Upvote 0
DonManfred said: Simple. Do not publish Apps Click to expand... Why does the device's file manager have access to the Download folder? Tried using ContentChooser, but the app was rejected in AppGallery and RuStore.
Star-Dust Expert Licensed User Longtime User Feb 27, 2025 #4 It is not correct to say that access is only granted with ContentChooser. It is also possible to access (read/write) the download folder without permissions with MediaStore. It depends on what you need to do. See here https://www.b4x.com/android/forum/threads/-b4a-save-a-file-to-the-download-folder-and-document-pictures-music-movies-dcim-folders.165408/ Upvote 0
It is not correct to say that access is only granted with ContentChooser. It is also possible to access (read/write) the download folder without permissions with MediaStore. It depends on what you need to do. See here https://www.b4x.com/android/forum/threads/-b4a-save-a-file-to-the-download-folder-and-document-pictures-music-movies-dcim-folders.165408/
DonManfred Expert Licensed User Longtime User Feb 27, 2025 #5 Sergey_New said: Why does the device's file manager have access to the Download folder? Click to expand... Probably because it is a Systemapp. Upvote 0
Sergey_New said: Why does the device's file manager have access to the Download folder? Click to expand... Probably because it is a Systemapp.
Star-Dust Expert Licensed User Longtime User Feb 27, 2025 #6 Sergey_New said: Why does the device's file manager have access to the Download folder? Tried using ContentChooser, but the app was rejected in AppGallery and RuStore. Click to expand... because it is a direct user permission and cannot be tampered with. So it has administrator permissions Upvote 0
Sergey_New said: Why does the device's file manager have access to the Download folder? Tried using ContentChooser, but the app was rejected in AppGallery and RuStore. Click to expand... because it is a direct user permission and cannot be tampered with. So it has administrator permissions
Sergey_New Well-Known Member Licensed User Longtime User Feb 27, 2025 #7 Star-Dust said: It depends on what you need to do. Click to expand... In addition to media files, I need to copy text files. Is this possible? Upvote 0
Star-Dust said: It depends on what you need to do. Click to expand... In addition to media files, I need to copy text files. Is this possible?
Star-Dust Expert Licensed User Longtime User Feb 27, 2025 #8 If you need to save text files you can do it, I just have to change the mime type. If you need to read files it's another thing. Upvote 0
If you need to save text files you can do it, I just have to change the mime type. If you need to read files it's another thing.
Sergey_New Well-Known Member Licensed User Longtime User Feb 27, 2025 #9 Star-Dust said: If you need to read files it's another thing. Click to expand... I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them. The user does not have access to this folder to put files from Download there himself. Right? Upvote 0
Star-Dust said: If you need to read files it's another thing. Click to expand... I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them. The user does not have access to this folder to put files from Download there himself. Right?
Star-Dust Expert Licensed User Longtime User Feb 27, 2025 #10 You should do a test. In fact, everything that is linked by Mediastore (audio/images/video) is possible to read and write it. I also managed to write the text, Json and more, I didn't try to read it. At the moment I can't do a test, you should make attempts on the basis of the code I shared. Upvote 0
You should do a test. In fact, everything that is linked by Mediastore (audio/images/video) is possible to read and write it. I also managed to write the text, Json and more, I didn't try to read it. At the moment I can't do a test, you should make attempts on the basis of the code I shared.
Sergey_New Well-Known Member Licensed User Longtime User Feb 27, 2025 #11 Star-Dust said: you should make attempts on the basis of the code I shared. Click to expand... Thank you! Unfortunately I don't have access to LinkedIn. Upvote 0
Star-Dust said: you should make attempts on the basis of the code I shared. Click to expand... Thank you! Unfortunately I don't have access to LinkedIn.
Star-Dust Expert Licensed User Longtime User Feb 27, 2025 #12 I did some tests, it is not possible to have the list of files in the download folder. It is not possible to read a file in the download folder whose name is known Upvote 0
I did some tests, it is not possible to have the list of files in the download folder. It is not possible to read a file in the download folder whose name is known
Sergey_New Well-Known Member Licensed User Longtime User Feb 28, 2025 #13 Star-Dust said: It is not possible to read a file in the download folder whose name is known Click to expand... I didn't understand this phrase. Can a file whose name is unknown be read? Star-Dust said: So it has administrator permissions Click to expand... DonManfred said: Probably because it is a Systemapp. Click to expand... There are file managers on Google Play that can be installed on any device. And they have access to its folders. Why do they get administrator rights or become system ones? Upvote 0
Star-Dust said: It is not possible to read a file in the download folder whose name is known Click to expand... I didn't understand this phrase. Can a file whose name is unknown be read? Star-Dust said: So it has administrator permissions Click to expand... DonManfred said: Probably because it is a Systemapp. Click to expand... There are file managers on Google Play that can be installed on any device. And they have access to its folders. Why do they get administrator rights or become system ones?
Mehrzad238 Active Member Feb 28, 2025 #14 Sergey_New said: In addition to media files, I need to copy text files. Is this possible? Click to expand... If you need to copy and access a file, you go this way, but I'm not sure exactly what you want! you can create a folder in path ===>> Internal storage > Android > Data >application packagename by using this line B4X: Copy rp.CheckAndRequest(rp.GetSafeDirDefaultExternal("name a folder")) And by using ContentChooser, you can copy anything on that path and, like below B4X: Copy Dim Path As String=rp.GetSafeDirDefaultExternal("your folder name") File.Copy(Dir,FileName,Path ,"anyname with any format will do the job") By just using Path, you can access your file for anything, but you have to do it manually Upvote 0
Sergey_New said: In addition to media files, I need to copy text files. Is this possible? Click to expand... If you need to copy and access a file, you go this way, but I'm not sure exactly what you want! you can create a folder in path ===>> Internal storage > Android > Data >application packagename by using this line B4X: Copy rp.CheckAndRequest(rp.GetSafeDirDefaultExternal("name a folder")) And by using ContentChooser, you can copy anything on that path and, like below B4X: Copy Dim Path As String=rp.GetSafeDirDefaultExternal("your folder name") File.Copy(Dir,FileName,Path ,"anyname with any format will do the job") By just using Path, you can access your file for anything, but you have to do it manually
Sergey_New Well-Known Member Licensed User Longtime User Feb 28, 2025 #15 Mehrzad238 said: but I'm not sure exactly what you want! Click to expand... Said above: Sergey_New said: I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them. Click to expand... Upvote 0
Mehrzad238 said: but I'm not sure exactly what you want! Click to expand... Said above: Sergey_New said: I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them. Click to expand...
Mehrzad238 Active Member Feb 28, 2025 #16 Sergey_New said: I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them Click to expand... If you need this, my code will do the job, but you have to do it manually. If you want it to be done automatically, that is another story. So, if your text comes from your host, just download and save it on this path. B4X: Copy rp.CheckAndRequest(rp.GetSafeDirDefaultExternal("name a folder")) After that, practically you can do anything with that file. But from the download folder, the user must choose that. Which you have to copy on the Path that you created. After that, practically you can do anything with that file. Let me explain what exactly I am proposing here: So you choose your file from internal storage with this code and copy that in your folder that is accessable: B4X: Copy cc.Show("*/*", "choose a file") Wait For cc_Result (Success As Boolean, Dir As String, FileName As String) Dim Path As String=rp.GetSafeDirDefaultExternal("your folder name") File.Copy(Dir,FileName,Path ,"anyname with any format will do the job") This was for manually for automatically I believe is even easier with OkHttpJob2 Just before doing anything of this use RuntimePermissions to create Path so be existed(I use it when I want to get notification PERMISSION from user) Upvote 0
Sergey_New said: I need to copy text files from the Download folder to a folder created by the application in DirInternal and then read them Click to expand... If you need this, my code will do the job, but you have to do it manually. If you want it to be done automatically, that is another story. So, if your text comes from your host, just download and save it on this path. B4X: Copy rp.CheckAndRequest(rp.GetSafeDirDefaultExternal("name a folder")) After that, practically you can do anything with that file. But from the download folder, the user must choose that. Which you have to copy on the Path that you created. After that, practically you can do anything with that file. Let me explain what exactly I am proposing here: So you choose your file from internal storage with this code and copy that in your folder that is accessable: B4X: Copy cc.Show("*/*", "choose a file") Wait For cc_Result (Success As Boolean, Dir As String, FileName As String) Dim Path As String=rp.GetSafeDirDefaultExternal("your folder name") File.Copy(Dir,FileName,Path ,"anyname with any format will do the job") This was for manually for automatically I believe is even easier with OkHttpJob2 Just before doing anything of this use RuntimePermissions to create Path so be existed(I use it when I want to get notification PERMISSION from user)