Other ExternalStorage v1.01 omission :(

agraham

Expert
Licensed User
Longtime User
Erel has locked the ExternalStorage thread so I can't comment there but I'm afraid he hasn't included the fix for the problem of repeated requests to grant permission because of differing prefixes to the saved and requested Uris.

https://www.b4x.com/android/forum/threads/solved-trouble-with-external-storage-class.101657/

In SelectDir
B4X:
'Dim s As String = u 'ignore Originally
Dim temp As Object = u ' Erel's Solution
Dim s As String = temp

In ion_Event
B4X:
'PersistantUri = treeUri 'ignore Originally  
Dim temp As Object = treeUri ' Erel's solution
PersistantUri = temp
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Fixed in v1.02.

Worth an explanation:
B4X:
Dim u As Uri = ...
'now we want to convert the URI to string:
Dim s As String = u
We are relying on the default toString method implementation. However because Uri is an object wrapper it adds the object type to the output string:
(HierarchicalUri) content://...

Solution is to get the unwrapped uri and convert it to string (after we verified that the native toString method is good for us):
B4X:
Dim o As Object = u
Dim s As String = o
 
Upvote 0
Top