jfversluis / FilePicker-Plugin-for-Xamarin-and-Windows

FilePicker Plugin for Xamarin and Windows
MIT License
157 stars 80 forks source link

Error to get stream files PDF, access denied #154

Closed Frankpalacio closed 4 years ago

Frankpalacio commented 5 years ago

Actual Behavior

Permission Denial: opening provider com.android.providers.downloads.DownloadStorageProvider from ProcessRecord{e8c4a48d0 14678:com.companyname.litigiovirtual.admin/u0a213} (pid=14678, uid=10213) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs ---> Android.OS.RemoteException: Remote stack trace:

Specifications

vividos commented 5 years ago

Do you have a stack trace for us as well?

vividos commented 5 years ago

Could it be that you denied permissions on the start of picking? Googling the error message yields to answers where the permission wasn't given.

heinst commented 5 years ago

I am having the same issue. That is all the info it gives, I think. This is on the DataArray property

I allowed permission as well. Both through here, and did permission checking through PermissionsPlugin. That plugin is saying both Storage and MediaLibrary permission is granted.

Not sure if this would help https://stackoverflow.com/questions/22178041/getting-permission-denial-exception

heinst commented 5 years ago

I figured it out. Its not a problem with the library. Somewhere along the way, the reference to the file data is being lost. I fixed it within our implementation by saving the file data in a different object, then referencing the filedata else where

vividos commented 5 years ago

That may be the reason. After picking you should immedately save the file somewhere in your cache or data folder, or open the stream so that access to the file is guaranteed.

heinst commented 5 years ago

Yeah that might be something to note in the README or elsewhere. In my implementation of the FilePicker, we have one command add the files to a list, and another that goes through the same list and gets the file data to send to the backend, which is where I noticed the error. I’m sure we’re not the only ones that will use it in this manner

sriharrsha commented 4 years ago

@heinst How did you fix this in your implementation ?

heinst commented 4 years ago

@sriharrsha I made a model with a byte array property. After a user picks a file and you get the file info from the nuget, you want to immediately copy those properties over to the new model you made for use elsewhere in the VM

vividos commented 4 years ago

Your issue could also be fixed with PR #178. Could you test this with 2.1.41-beta if it still happens? Thanks!

vashov commented 4 years ago

@vividos I had similar issue with 2.1.34, there are no trouble with 2.1.41-beta, thanks

jfversluis commented 4 years ago

Closing this since this project will retire, please check out Xamarin.Essentials which now has a FilePicker based on this one.