Android Question Rp.GetAllSafeDirsExternal returns Permission Denied

SJQ

Member
Licensed User
Longtime User
Got a problem with Android 9 x86

We use two insertable storage devices, A Removable SD card is inserted that contains an extensive media library and when required staff must insert another USB and a process in the app writes specific statistics to this USB mass storage device.

previously Rp.GetAllSafeDirsExternal has worked on ARM devices for Android 6, 7 (I don’t have an Android 9 Device running on ARM to test) and Rp.GetAllSafeDirsExternal returns a directory that we can write this stats file to the removable Mass Storage. (internet or any Wi-Fi/ethernet is forbidden)

example build configuration package name: com.myb4aapp

Rp.GetAllSafeDirsExternal("") returns for example:

/storage/emulated/0/Android/data/ com.myb4aapp /files (same return as File.DirDefaultExternal)
/storage/121E-3344/Android/data/com.myb4aapp /files
/storage/BE99-160B/Android/data/com.myb4aapp/files

However, on the Android 9 x86 device when creating the stats file I get the following:

java.io.FileNotFoundException: /storage/121E-3344/Android/data/ com.myb4aapp /files/StatsExp.csv (Permission denied)

Required file permissions were granted…

Is this an Andoid 9 issue or x86 issue or both, and is there any other way around it??
 

DonManfred

Expert
Licensed User
Longtime User
s this an Andoid 9 issue or x86 issue or both, and is there any other way around it??
The ONLY way to access external storage (real external storage) is to use the ExternalStorage Class.
 
Upvote 0

SJQ

Member
Licensed User
Longtime User
Is it possible to automate this without requiring the user to make a drive selection?
 
Upvote 0

SJQ

Member
Licensed User
Longtime User
Oooh that’s not going to go down well… I’ve met our end users and its grim.

I can’t trust them to press the correct button even when its highlighted, flashing and huge… Never mind navigating an obscure default file manager to make such a complex (because to them it is) choice.

Really, I wonder if google has actually met its end users… I know professional IT people that struggle with the Android filing system never mind general users.

And on top of that its not likely to be the same USB more than once.
 
Upvote 0

Unobtainius

Active Member
Licensed User
Longtime User
Oooh that’s not going to go down well… I’ve met our end users and its grim.

I can’t trust them to press the correct button even when its highlighted, flashing and huge… Never mind navigating an obscure default file manager to make such a complex (because to them it is) choice.

Really, I wonder if google has actually met its end users… I know professional IT people that struggle with the Android filing system never mind general users.

And on top of that its not likely to be the same USB more than once.
Some of my end users are truck drivers, so I feel you brother. Usually I just end up asking if they still have the boxes their computer came in, and if so, advise them to pack it up, take it back to the shop they got it from, and tell the sales assistant they are too dumb to use a computer :p
 
  • Like
Reactions: SJQ
Upvote 0

Unobtainius

Active Member
Licensed User
Longtime User
If any truck drivers read my reply, well done, youre reading now! Nah, just kidding. Maybe
 
  • Like
Reactions: SJQ
Upvote 0

SJQ

Member
Licensed User
Longtime User
I'm waiting for the fall out from this... its not just the end users but the client senior management whos technical abilities start and end at a matchbox just wont understand.

part of the problem is Googles unhelpful helpfulness, in the default file manager that opens in this process it loads the 'Recent' page first with absolutely no obvious path or indication on what to do.

Thing with this is, out of the drives connected I know what drive to use, I just can't see a way to pass this in as a parameter.
 
Upvote 0

SJQ

Member
Licensed User
Longtime User
I take it the function the user has to use returns a URI for the root of the drive?

I've found a code snippet on here to convert a file path to a URI, in the FileProvider class, doesn't work as it is though.

But there must be some way to format this to the correct requirement?
 
Upvote 0
Top