Android Question ExternalStorage Class - Some files do not appear using Findfile function

prbmjr

Active Member
Licensed User
Hi Everyone!

I'm using the ExternalStorage Class to find a specific file inside a specific folder inside a external USB connected, I can find the usb stick, and the folder perfectly, but when I use the Storage.Findfile function, the file inside the folder do not appear, I tried to use the listfiles function too but the files did not appear too, I tried to find a file recently copied to the usb stick, in another folder and happened the same...

The files are there because I can see the files using the Samsung app Myfiles... and I can see the files in my laptop too.

Any ideas what's going on?

Thank you in advance!
 

agraham

Expert
Licensed User
Longtime User
What SDK are you targeting and are you running on Android 11. Unfortunately Android 11 now imposes restrictions on ExternalStrage that weren't there before making it less useful. See the 'Grant access to a directory's contents' section here

Access documents and other files from shared storage (android.com)

I've been trying to get my head round the various permutations of file access with Android and target SDK versions and have become thoroughly confused with what did work, works now and will work in the future. As my apps will not go into the Play Store I just keep them targeted at SDK 28 and things just work!

As a test try targeting SDK 28 and see if it works.
 
Upvote 0

prbmjr

Active Member
Licensed User
[SOLVED]

I had not previously pick the folder correctly before try to find the files... My mistake... sorry... Now I can see all files...

Thanks !!
 
Upvote 0

prbmjr

Active Member
Licensed User
What SDK are you targeting and are you running on Android 11. Unfortunately Android 11 now imposes restrictions on ExternalStrage that weren't there before making it less useful. See the 'Grant access to a directory's contents' section here

Access documents and other files from shared storage (android.com)

I've been trying to get my head round the various permutations of file access with Android and target SDK versions and have become thoroughly confused with what did work, works now and will work in the future. As my apps will not go into the Play Store I just keep them targeted at SDK 28 and things just work!

As a test try targeting SDK 28 and see if it works.

Hi Agraham,

My problem before was I'm not using correctly the function, I'm using now SDK 29.

That's very interesting, if I understand your comments correctly, Android 11 do not permit manipulate files freely in an externalStorage?

In my case I only need to find a file and read this file... Do you think the ExternalStorage Class will work for mein my case?

Thanks!
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Do you think the ExternalStorage Class will work for mein my case?
I don't know :( As I said, I'm thoroughly confused at the moment about what might or might not work with various Android versions and SDK targets. In my experiments some things that that shouldn't work seem to half work so I have given up playing with it as targeting SDK 28 works for me and retains my fragile sanity regarding Android and Google šŸ˜–
 
Upvote 0
Top