Android Question Android 11 limits use of rp.getsafeDirDefaultExternal

Cliff McKibbin

Licensed User
I have been using rp.getsafeDirDefaultExternal successfully for some time as it allows me to exchange sql db files in and out of a device.

Specifically, I have used it to:
1. allow a user to email his .db file to a second device so that the two are synced.
2. allow the user to email the file to his computer and store it on that device so that it can be sent back to his android device if necessary to restore.

This was all possible as the file was visible in 'internal storage', 'android', 'data', 'b4a.myappname', 'files', 'mydir'. The file could be replaced as necessary by moving it from the download directory to 'MyDir'.

As of Android 11, the 'Android', 'data' files are now invisible, so these techniques are no longer feasible.

I have been looking for a solution and Erel's latest forum post:
has reminded me of the drum-beat I have been seeing related to doing away with all file locations except for file.dirinternal.

I have tested file.dirinternal and confirmed (again) that I can't see it on my device so that it doesn't seem I can use it in the same way I have been using it.

I do have workarounds for my two uses in the form of:
1. I have sync logic using bluetooth.
2. I could use the android cloud based backup.

My questions:

1. Is there any work-around for seeing my files in Android 11?
2. Is there any other option for initializing a file that can be 'seen' using the standard 'my files' app in android?
3. For the purpose of backup, is there a preference for the cloud based backups offered: (Samsung, Google, etc.)

Thanks for any ideas, Cliff McKibbin
Last edited:


Licensed User
Longtime User
Have you tried using Erel's File Provider class and specifying the .DB file (using this class) for the attachment to the email?

Upvote 0


Licensed User
Longtime User
If it's for your own use, which is what it soundes like then you could use
It won't let you access the Android/data folder but you otherwise you can save your files just about anywhere.

Alternatively just target SDK 28 and things should work as before.
Upvote 0


Well-Known Member
Licensed User
Longtime User
unless you opt to use either of the solutions suggested above, the app which sends the file via email has to be the app which created the db. i use google cloud to update app db's. no issues currently. (one hint: you need some way to make sure users have the latest version of the db. i use a separate file with a version number their app can compare with one kept on board. you can run a little service to check if there is a newer version of the db available. or just have the user check when she feels like it.)
Upvote 0