Closed championofblocks closed 4 years ago
What about considering using ACTION_OPEN_DOCUMENT starting from a specific Android version on, without being able for the user to configure it? Does it show the same UI as when using ACTION_GET_CONTENT?
@vividos yeah we could do that but there's no indication in our testing that this is specific to an Android OS – it seems more device specific, or perhaps specific to the device's cloud storage setup. It's hard to be sure because only one device is exhibiting this.
Based on the documentation, it sounds like ACTION_OPEN_DOCUMENT might be a better option for sure and we haven't seen any difference in the UI or capabilities offered between this and the ACTION_GET_CONTENT
On Android 4.4 (API level 19) and higher, you have the additional option of using the ACTION_OPEN_DOCUMENT intent, which displays a system-controlled picker UI controlled that allows the user to browse all files that other apps have made available. From this single UI, the user can pick a file from any of the supported apps.
Happy to use your suggested approach but I think the library could arguably be more flexible in this regard, allowing developers to make their own choice of intent action while providing some sensible defaults
Closing this since this project will retire, please check out Xamarin.Essentials which now has a FilePicker based on this one.
Adding an overridable intent action property for the Android file picker implementation
Description of Change
On some Android devices we see this error when attempting to pick a file:
java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.docs.storagebackend.StorageBackendContentProvider from ProcessRecord{c8decebd0 6909:<package_name>/u0a206} (pid=6909, uid=10206) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
So while
Intent.ActionGetContent
seems to work in most cases,Intent.ActionOpenDocument
seems to work more consistently. Rather than change the intent action, this PR seeks to allow the user to subclassFilePickerImplementation.android.cs
and override the intent action when they feel a different intent action might be more appropriate.Issues Resolved
Platforms Affected