Hi all,
using External Storage class I know that if root folder no longer exist then the folder picker dialog will appear again, and in SelectDir there is an option to reuse or not the previous folder.
The picker will show, but before I need to show a messagebox that explain user that need to create and select the app folder.
Just a first time if permissions not already granted or if permissions already granted but user removed manually the folder.
Actually my app show a redundant messagebox all the times I start it, then if no permissons granted will show the picker dialog, otherwise just will continue, but I want to avoid show a messagebox if picker dialog wil not appear because permissions already granted.
Is there a way to do it ?
Consider this code:
I tried to check these conditions but probably I miss something, and do not know how check if folder exist:
Many thanks
using External Storage class I know that if root folder no longer exist then the folder picker dialog will appear again, and in SelectDir there is an option to reuse or not the previous folder.
The picker will show, but before I need to show a messagebox that explain user that need to create and select the app folder.
Just a first time if permissions not already granted or if permissions already granted but user removed manually the folder.
Actually my app show a redundant messagebox all the times I start it, then if no permissons granted will show the picker dialog, otherwise just will continue, but I want to avoid show a messagebox if picker dialog wil not appear because permissions already granted.
Is there a way to do it ?
Consider this code:
B4X:
Sub CheckExternalStoragePermission As ResumableSub
If Not(Storage.HasPermission) Then
MsgboxAsync("We show you a file manager, please create a new folder to use as Application Folder and select it.","Create 'MaxCNC' folder")
Wait For MsgBox_Result (Result As Int)
End If
Storage.SelectDir(True)
Wait For Storage_ExternalFolderAvailable
Return (Storage.Root.IsFolder And Storage.Root.Name <> "")
End Sub
B4X:
'Check if permission is already granted.
Public Sub HasPermission As Boolean
Return File.Exists(File.DirInternal, PreviousUriFileName) And File.ReadString(File.DirInternal, PreviousUriFileName).Length > 0
End Sub
'Public Sub IsStorageFolderSelected As Boolean
' If PersistantUri.Length > 0 Then
' Root = DocumentFileToExternalFile(GetPickedDir(PersistantUri))
' Log("Root.Length=" & Root.Length)
' End If
' Return File.Exists(File.DirInternal, PreviousUriFileName) And (Root.Length > 0)
'End Sub
Many thanks
Last edited: