R RJB Active Member Licensed User Longtime User Oct 8, 2020 #1 (I've spent many hours searching on the forum but can't find the answer, it might be there but I can't find it!) Is it possible to list/ read files from folders, such as DCIM, in newer versions of Android? And if so how? https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/#content seems to indicate that it's not possible at all in sdk 30+ It will not work with targetSdkVersion=30. Avoid using File.DirRootExternal. Either use File.DirInternal or RuntimePermissions.GetSafeDirDefaultExternal. Click to expand...
(I've spent many hours searching on the forum but can't find the answer, it might be there but I can't find it!) Is it possible to list/ read files from folders, such as DCIM, in newer versions of Android? And if so how? https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/#content seems to indicate that it's not possible at all in sdk 30+ It will not work with targetSdkVersion=30. Avoid using File.DirRootExternal. Either use File.DirInternal or RuntimePermissions.GetSafeDirDefaultExternal. Click to expand...
Erel B4X founder Staff member Licensed User Longtime User Oct 8, 2020 #2 RJB said: at all in sdk 30+ Click to expand... There is no such term. The important tutorial explains the terms. The solution with requestLegacyExternalStorage will work with Android 11 devices. The catch is that Google is expected to disallow it when targetSdkVersion needs to be set to 30 (next year). You can use ContentChooser or ExternalStorage to access files without needing any permission. The user will need to select the folder or file. Upvote 0
RJB said: at all in sdk 30+ Click to expand... There is no such term. The important tutorial explains the terms. The solution with requestLegacyExternalStorage will work with Android 11 devices. The catch is that Google is expected to disallow it when targetSdkVersion needs to be set to 30 (next year). You can use ContentChooser or ExternalStorage to access files without needing any permission. The user will need to select the folder or file.
Midimaster Active Member Licensed User Oct 8, 2020 #3 As I also still do not understand how to continue in future, I join here and ask: The given case: The year is 2022. My app needs to be avaiable on the Google Playstore. The user has no SD card, the only avaiable memory is the device build in momory. The user has a special file (from anywhere) of no known MIMI-type and a special Extension ".abc". The user transfers this file with USB f.e. to dir DCIM or with Whatsapp to dir DOWNLOAD. How can I reach this file from my app? My app now manipulates this file and needs to offer the user the resulting file for sending it to a PC or forwaring it to next friend via Whatapp, etc.. How can I save this file in a common area? As I understand ContentChooser works only with files of a known MIME and ExternalStorage only with SD-card Upvote 0
As I also still do not understand how to continue in future, I join here and ask: The given case: The year is 2022. My app needs to be avaiable on the Google Playstore. The user has no SD card, the only avaiable memory is the device build in momory. The user has a special file (from anywhere) of no known MIMI-type and a special Extension ".abc". The user transfers this file with USB f.e. to dir DCIM or with Whatsapp to dir DOWNLOAD. How can I reach this file from my app? My app now manipulates this file and needs to offer the user the resulting file for sending it to a PC or forwaring it to next friend via Whatapp, etc.. How can I save this file in a common area? As I understand ContentChooser works only with files of a known MIME and ExternalStorage only with SD-card
Erel B4X founder Staff member Licensed User Longtime User Oct 8, 2020 #4 It is never a good idea to post in existing threads. There should only be a question in the very first post. Midimaster said: As I understand ContentChooser works only with files of a known MIME Click to expand... No. You can pass */*. Try it and you will see: Code: Copy Sub Activity_Click Dim cc As ContentChooser cc.Initialize("cc") cc.Show("*/*", "") Wait For CC_Result (Success As Boolean, Dir As String, FileName As String) If Success Then Log(Dir) Log(FileName) End If End Sub Midimaster said: and ExternalStorage only with SD-card Click to expand... No. Try it as well. Upvote 0
It is never a good idea to post in existing threads. There should only be a question in the very first post. Midimaster said: As I understand ContentChooser works only with files of a known MIME Click to expand... No. You can pass */*. Try it and you will see: Code: Copy Sub Activity_Click Dim cc As ContentChooser cc.Initialize("cc") cc.Show("*/*", "") Wait For CC_Result (Success As Boolean, Dir As String, FileName As String) If Success Then Log(Dir) Log(FileName) End If End Sub Midimaster said: and ExternalStorage only with SD-card Click to expand... No. Try it as well.
Midimaster Active Member Licensed User Oct 8, 2020 #5 Ah! thank you. There are several posts here with misleading informations But your aswer is a clear statement. Somebody should sum up all (future) file strategies in a separat new tutorial. Because there are a lot of requests in the last weeks related to that topic. And this amount of posts shows that the (future) method to handle file related things is not clear to a lot of users. Upvote 0
Ah! thank you. There are several posts here with misleading informations But your aswer is a clear statement. Somebody should sum up all (future) file strategies in a separat new tutorial. Because there are a lot of requests in the last weeks related to that topic. And this amount of posts shows that the (future) method to handle file related things is not clear to a lot of users.