you may have already discovered all or most of this.
the key: "The permission denial issue needs to be dealt with the first time you receive a URI."
our content chooser is designed to allow one-time access a resource: at the time of selection. to access the same resource at some other time, you have to run the chooser again and select the same resource. not the end of the world, but it is what it is. saving the uri in some file for later access does not work. (obviously, copying the contents of the uri to local storage is a different matter, but we're talking about saving the uri as if it were some file name.)
the explanation is found at
https://stackoverflow.com/questions...n-action-get-content-and-action-open-document
basically:
Use ACTION_GET_CONTENT if you want your app to simply read/import data. when the selection is made in the chooser.
Use ACTION_OPEN_DOCUMENT if you want your app to have long term, persistent access to documents owned by a document provider.
our content chooser uses ACTION_GET_CONTENT. whether it can simply be recompiled with ACTION_OPEN_DOCUMENT is something i'm working up to.
while recompiling might be simple enough, there is another part to the solution. that part is a little more involved.
it is found here:
https://developer.android.com/reference/android/content/Intent.html#ACTION_OPEN_DOCUMENT
basically:
a persistable permission must be granted by the provider. this would be done when the chooser returns the uri (our chooser only returns the uri)
that permission then needs to be "taken" by the entity that accesses the uri.
if you want to maintain access to the resource, you need to explicitly take the persistable permissions using ContentResolver#takePersistableUriPermission(Uri, int).
in other words, the provider will supply the special permission, but the entity that wants to access the uri at a later time has to capture that permission when the uri is first
received and then invoke the permission the next time it tries to access the resource using the originally supplied uri. so, save the permissions + the uri and then use them both later.
i'm thinking (hoping) a remodeled chooser will expose the permission. then, when the chooser triggers the CC_result event, it can return the permission to the app, along with the uri.
at least that's what i'm going to try.