Android Question Question about app update from 05/05/2021

D

Deleted member 103

Guest
Hi,

my app creates a folder under "File.DirRootExternal" when it starts, for example: File.DirRootExternal & "/ MyFolder". All race files created by the user are stored here. In this way, the files will not be deleted if the user has to uninstall and reinstall the app for any reason.

My problem is, when I update now, I am no longer allowed to simply access "File.DirRootExternal" and thus I can no longer copy all existing files from File.DirRootExternal & "/MyFolder" to "RuntimePermissions.GetAllSafeDirsExternal" without user invocation.

You could also use the "ExternalStorage" class, but that seems a bit more complicated than just using "RuntimePermissions.GetAllSafeDirsExternal".

I can also tell the user to copy the files himself, but many users are overwhelmed with such tasks.

If someone had the same problem, how did they solve it?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I can also tell the user to copy the files himself, but many users are overwhelmed with such tasks.
Most users will not know how to do such thing.

You can let the user select files to "import" with ContentChooser. This is quite simple. You can also let the user select the folder with ExternalStorage. It is not too complicated.
 
Upvote 0
D

Deleted member 103

Guest
Most users will not know how to do such thing.

You can let the user select files to "import" with ContentChooser. This is quite simple. You can also let the user select the folder with ExternalStorage. It is not too complicated.
Thank you Erel.
I have to choose a solution that is satisfactory for me and the users.

If I use the "ContentChooser" function for import, then the data is deleted after uninstalling the App.

If I use "ExternalStorage", then the user must pick again after each new boot of the storage folders, and that can provide for bad feedback.

But I think the solution with "ExternalStorage" is the better solution.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If I use "ExternalStorage", then the user must pick again after each new boot of the storage folders
Yes? Why?
Store the selected path (create a uri for it and store it in a DB or whereever.
Or future appstarts you get the stored uri and create a externalfile reference out from it.
Work with ExternalStorage class ;-)
 
Upvote 0
D

Deleted member 103

Guest
Yes? Why?
Store the selected path (create a uri for it and store it in a DB or whereever.
Or future appstarts you get the stored uri and create a externalfile reference out from it.
Work with ExternalStorage class ;-)
Okay, then I must have misunderstood this below.
1. Call ExternalStorage.SelectDir. This will open a dialog that will allow the user to select the root folder. Once selected the uri of the root folder is stored and can be later used without requiring the user to select the folder again. Even after the device is booted.

@Erel
1. Existing users will be able to import their files.
2. You can use it together with SaveAs: https://www.b4x.com/search?query=SaveAs.
Yes, I realize that, but think the user before a deinstallation to save?
I know you can't do everything for the user, but if something stops working, it's always the programmer's fault. :rolleyes:
 
Upvote 0
Top