Hi. Thanks very much for this plugin. I was looking for a way to obtain persistent access to external files, and happened to find your plugin from a discussion on https://github.com/miguelpruivo/flutter_file_picker.
I have had great success with your plugin when launching the picker with FilePickerWritable().openFilePicker(). However when opening a file from another app via an intent on Android I get the following error:
D/FilePickerWritable(26622): onNewIntent(content://com.android.providers.downloads.documents/document/22896)
D/FilePickerWritable(26622): Got method call: init
D/FilePickerWritable(26622): Error while handling method call io.flutter.plugin.common.MethodCall@3d1625c
D/FilePickerWritable(26622): java.lang.SecurityException: No persistable permission grants found for UID 10421 and Uri content://com.android.providers.downloads.documents/document/22896 [user 0]
D/FilePickerWritable(26622): at android.os.Parcel.createException(Parcel.java:2071)
D/FilePickerWritable(26622): at android.os.Parcel.readException(Parcel.java:2039)
D/FilePickerWritable(26622): at android.os.Parcel.readException(Parcel.java:1987)
D/FilePickerWritable(26622): at android.app.IUriGrantsManager$Stub$Proxy.takePersistableUriPermission(IUriGrantsManager.java:280)
D/FilePickerWritable(26622): at android.content.ContentResolver.takePersistableUriPermission(ContentResolver.java:2428)
D/FilePickerWritable(26622): at codeux.design.filepicker.file_picker_writable.FilePickerWritableImpl$copyContentUriAndReturnFileInfo$2.invokeSuspend(FilePickerWritableImpl.kt:227)
D/FilePickerWritable(26622): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
D/FilePickerWritable(26622): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
D/FilePickerWritable(26622): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
D/FilePickerWritable(26622): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
D/FilePickerWritable(26622): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
D/FilePickerWritable(26622): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
D/FilePickerWritable(26622): Caused by: android.os.RemoteException: Remote stack trace:
D/FilePickerWritable(26622): at com.android.server.uri.UriGrantsManagerService.takePersistableUriPermission(UriGrantsManagerService.java:328)
D/FilePickerWritable(26622): at android.app.IUriGrantsManager$Stub.onTransact(IUriGrantsManager.java:139)
D/FilePickerWritable(26622): at android.os.Binder.execTransactInternal(Binder.java:1021)
D/FilePickerWritable(26622): at android.os.Binder.execTransact(Binder.java:994)
D/FilePickerWritable(26622):
It seems that takePersistableUriPermission won't always succeed so some error handling is necessary.
This indicates that takePersistableUriPermission is only valid for the ACTION_OPEN_DOCUMENT intent, which it seems can only be initiated by my application; for receiving other intents (like VIEW) from other applications, takePersistableUriPermission should not be invoked.
Either that, or perhaps my configuration is wrong?
I tried your example app, and I couldn't get it to appear in the app selector for .codeux files at all.
Hi. Thanks very much for this plugin. I was looking for a way to obtain persistent access to external files, and happened to find your plugin from a discussion on https://github.com/miguelpruivo/flutter_file_picker.
I have had great success with your plugin when launching the picker with
FilePickerWritable().openFilePicker()
. However when opening a file from another app via an intent on Android I get the following error:It seems that
takePersistableUriPermission
won't always succeed so some error handling is necessary.This indicates that
takePersistableUriPermission
is only valid for theACTION_OPEN_DOCUMENT
intent, which it seems can only be initiated by my application; for receiving other intents (likeVIEW
) from other applications,takePersistableUriPermission
should not be invoked.Either that, or perhaps my configuration is wrong?
I tried your example app, and I couldn't get it to appear in the app selector for
.codeux
files at all.(Android 10 on a Pixel 2)