Android Question Problem retrieving imported data saved with File.DirRootExternal with API 30

energypf

Member
Licensed User
Longtime User
Hello, I have developed an App that saves patient medical reports in a folder outside the app.
Example: "/storage/emulated/0/appname/report.pdf".
Having ascertained that with the new versions it is no longer possible to use this function, I would like to understand how to release the new version which will be the new reports in an allowed folder, but which at the same time can move the old reports downloaded to the new app folder?
Otherwise, releasing the new version the user will find himself with the empty archive.
I also wanted to know which folder you recommend to use to save the new reports which should remain even if the user uninstalls the app.
Thanks in advance
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

agraham

Expert
Licensed User
Longtime User
Is this app distributed via the Play Store? If not then you can either keep targeting SDK 28 to retain access to your folder or use the manage external storage permission.

 
Upvote 0

energypf

Member
Licensed User
Longtime User
Questa app è distribuita tramite il Play Store? In caso contrario, puoi continuare a scegliere come target l'SDK 28 per mantenere l'accesso alla tua cartella o utilizzare l'autorizzazione per la gestione dell'archiviazione esterna.

Sì, è sul Playstore di Google.
 
Upvote 0

energypf

Member
Licensed User
Longtime User
There is no such thing unless you let the user manually choose the folder.

The options are listed here: https://www.b4x.com/android/forum/t...list-of-other-related-methods.129897/#content
If you need to open a file or two then ContentChooser will be good enough. For a full folder you need to use ExternalStorage.
So should I ask the user to select the "/ storage / emulated / 0 / appname" folder? But is this accessible with "ExternalStorage"?
Also if I can do this, Erel where do you advise me to save these files so that an uninstall does not remove them?

Thank you
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
So should I ask the user to select the "/ storage / emulated / 0 / appname" folder? But is this accessible with "ExternalStorage"?
It should be, try it. Judging from that path you have created a folder named 'appname' in the external storage root, this should survive uninstall - again just try it.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It should be, try it. Judging from that path you have created a folder named 'appname' in the external storage root, this should survive uninstall - again just try it.
I agree.

The other option which might be better, is to use XUI.DefaultFolder = File.DirInternal and provide an option for the user to export / import the data. You can create a zip file with all relevant files.
You can then use the "SaveAs" code for export and ContentChooser for import. The user will be able to save it on their Google Drive, external storage and many other places.
 
Upvote 0

energypf

Member
Licensed User
Longtime User
There is no such thing unless you let the user manually choose the folder.

The options are listed here: https://www.b4x.com/android/forum/t...list-of-other-related-methods.129897/#content
If you need to open a file or two then ContentChooser will be good enough. For a full folder you need to use ExternalStorage.
My first problem is to move the content in the "/storage/emulated/0/ appname" folder to a folder accessible according to the new criteria imposed by google. So how can I get the old medical reports to the app or user to move to a new folder?
Then for the new ones I will see how and where to save them.
 
Upvote 0

energypf

Member
Licensed User
Longtime User
As I said above in post #6. Have you actually tried using External Storage to access your folder?
Using "External Storage" with the function start authorization request. Thank you so much.
What do you advise me to leave the same folder or to manage some other way to save the Reports which, however, as mentioned before, must not be deleted in case of uninstalling the app.
 
Upvote 0

energypf

Member
Licensed User
Longtime User
I can't judge that for you. Just go ahead and try some things and decide what will satisfy your requirements.
For me it would be enough to simply save these files on the device without an uninstallation deleting the content.
 
Upvote 0

energypf

Member
Licensed User
Longtime User
As I said above in post #6. Have you actually tried using External Storage to access your folder?
I am trying the app on different devices, unfortunately on some when the message relating to permissions appears, immediately after clicking on OK, it does not open the APP permissions section to all files. What can it depend on?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

energypf

Member
Licensed User
Longtime User
Upload a small project showing the problem. We can not guess your code, your manifest....
I simply used the example you gave me. In most of the devices it places me on the section to set access to all files for the app, while in this device this section is not opened. What could it be?
 
Upvote 0
Top