Android Question ExternalStorage Class & File.DirRootExternal Problem

Ferdari

Active Member
Licensed User
Longtime User
I recently bought a new phone with Android 10 and tested my apps that worked good in Android 9-,

one of my function reads the DirRootExternal & SomeFolder to List more than 10k files and add to a listview, i found that cant access the Internal memory folders even with all the pemissions given.

Tried the ExternalStorage Class to fix, but when selecting the folder with 10k files from the Folder Picker from Files app just freezes and never respond.

So i was thinking, if the Files app can't read a folder with huge amount of files, what is the alternative to read InternalStorage to work with?

And also, why a simple File explorer app (like SolidExplorer)just needs to request WRITE_EXTERNAL_STORAGE to work without picking a folder with the older FolderPicker system app even on Android 10+?

So none of the two modes works for my app on Andorid10, so what is the real alternative to read the InternalStorage with only requesting Write External permission? (like SolidExplorer do)

i searched the forum and knew that the only way is ExternalStorage Class
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
What is the last update date for SolidExplorer that the playstore says?

Maybe the version of that app is old and using a lower targetsdklevel which lets it get away with stuff that a higher targetsdk can't.
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
What is the last update date for SolidExplorer that the playstore says?

Maybe the version of that app is old and using a lower targetsdklevel which lets it get away with stuff that a higher targetsdk can't.
Last update was Sept 29 2020, i cant read the targetSdk, is not visible. but if you search File Explorer in Google Play, there are too many that still working, also Google Play said that they will not accept Updates for apps lower than Api 29 this year.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
That's recent - It was just a hunch because Google won't let you post app updates unless then abide by the latest rules, and I thought maybe the app was updated a while ago, when apps had more ability to access external memory without the new restrictions. But this doesn't appear to be the case.

So, yeah, it is curious why it doesn't have the problems your app is experiencing.
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
That's recent - It was just a hunch because Google won't let you post app updates unless then abide by the latest rules, and I thought maybe the app was updated a while ago, when apps had more ability to access external memory without the new restrictions. But this doesn't appear to be the case.

So, yeah, it is curious why it doesn't have the problems your app is experiencing.
maybe they are using another files api or something, that we cant use in B4A, or is very new.
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
i Was reading this https://developer.android.com/training/data-storage/manage-all-files
on api 29 you can use:
Request All files access
An app can request All files access from the user by doing the following:
  1. Declare the MANAGE_EXTERNAL_STORAGE permission in the manifest.
  2. Use the ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION intent action to direct users to a system settings page where they can enable the following option for your app: Allow access to manage all files.
To determine whether your app has been granted the MANAGE_EXTERNAL_STORAGE permission, call Environment.isExternalStorageManager().

Im cheking if its possible to use on B4A...
 
Upvote 0

Midimaster

Active Member
Licensed User
As really a lot of the app-developers using B4A are confused about the future of reading/saving data into a "public" area on a smartphon, the ANYWHERE team should discuss nd find a common and forward looking solution. They should sum up all eventualities in a "How to share files in future" tutorial.

The adwise: "You should not longer use DirRootExternal" is not really helpful

I see this needs:

  • Scan a directory,
  • How to create Subfolders in Root
  • How to load well known file types like MP3 or JPG from the root folder
  • Save well known file types like MP3 or JPG from the root folder
  • Load a special data file with unknown Typ and free Extension like DAT or ABC
  • How to handle Indent for those self made files
  • Exchange any file with "Download"-Apps like Whatapp
  • Exchange any file with Cloud-solutions.
  • Do all these also with SD-cards
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Yes.

1: You still need to request the write external permission.
2: It will not be available in the future. At least not for "normal apps".
Ohh thats PERFECT Erel! i will try.

EDIT: IT WORKS!! thanks @Erel
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
Brilliant find šŸ‘ I think it is actually for API 30 and above, not 29 but I've bookmarked that page for further investigation.

As my programs don't go in the Play Store I shall certainly see if I can use this once my devices are upgraded to Android 11. In particular
Access to the root directory of both the USB on-the-go (OTG) drive and the SD card.
Looks like you won't need to use StorageAccessFramework to get at the SD Card :)
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Brilliant find šŸ‘ I think it is actually for API 30 and above, not 29 but I've bookmarked that page for further investigation.

As my programs don't go in the Play Store I shall certainly see if I can use this once my devices are upgraded to Android 11. In particular

Looks like you won't need to use StorageAccessFramework to get at the SD Card :)
Aye, is the same as now, but in Android 11 will ask for the special permission and only some specific apps like File explorers can use, or will not be accepted by Play team
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Aye, is the same as now, but in Android 11 will ask for the special permission and only some specific apps like File explorers can use, or will not be accepted by Play team
So? As I said I don't put apps in the Play Store so I don't care.
 
Upvote 0
Top