Xamarin.MediaGallery
Xamarin.MediaGallery copied to clipboard
Cannot pick files from Google Drive
Description
Picker opens, I get intent popups, tapped Allow, then selected Google Drive. All image files are grayed out.
Expected behavior
Able to pick up files from Google Drive. Xamarin.Essentials picker can do it.
Configuration
- Device: Galaxy Tab A SM-510
- OS Version: Android 11, One UI 3.1
- Plugin Version: latest
hi. Is this a problem with local files?
intent.PutExtra(Intent.ExtraLocalOnly, true);
This issue lies in this line. Unfortunately, if we remove it, we will get even more strange behavior on different Chinese devices. I faced the problem that when picking a video file from a cloud, a device returned its thumbnail (Low quality image) instead of the file itself.
I'm also surprised that Google Drive doesn't allow us to select local files. I think we can write to them about it
Sorry for the delay. I am real busy (arent we all) - I'll try to repro it when I get time. It's fifth or six in my OS github repro queue...
https://github.com/dimonovdd/Xamarin.MediaGallery/issues/93#issuecomment-1038488723
I found some time & made a sample!
Very interesting bug: Pick from local files works fine, but when I try to pick from Google Drive, everything is gray. Xamarin.Essentials image picker works without any extra steps.
Repro steps:
VS 2019
provided project
Set up Emulator as shown (Essentially Pixel/R/30 with 4GB RAM and forced GPU)
set up Google account there & make sure you have some images in your Google Drive app
Try to pick image from Drive. All is gray, you can only pick 'cancel'.
NOTE: Picking from Google Photos works!
@smalgin So far I see one solution: We can try not to display Google Drive to users at all http://stackoverflow.com/a/27780510/106941
I thought so. Makes sense in your position. But why Xamarin.Essentials picker doesn't have this issue??? Mystery...
Just some info on the most common use case I have:
Photos are taken much earlier by 3rd party & stored either on Drive or in shared album on Google Photos) In future, same for shared album/iCloud. Also in future: R&D picking photos from other shared storage apps available on mobile.
But why Xamarin.Essentials picker doesn't have this issue???
Because it has other problems. Read all my messages. It describes what causes this problem
@smalgin So far I see one solution: We can try not to display Google Drive to users at all http://stackoverflow.com/a/27780510/106941
In order to hide Google drive for video files picker can be used:
intent.SetType("video/*");
intent.SetAction(Intent.ActionPick);
// Or
intent.SetAction(Intent.ActionOpenDocument);
And to hide Google drive for image files picker
intent.SetType("image/*");
intent.SetAction(Intent.ActionPick);
// Or
intent.SetAction(Intent.ActionOpenDocument);