dimonovdd / Xamarin.MediaGallery

This plugin is designed to picking and save images and video files from native gallery of Android and iOS devices and capture photos
MIT License
148 stars 18 forks source link

Cannot pick files from Google Drive #87

Open smalgin opened 2 years ago

smalgin commented 2 years ago

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

dimonovdd commented 2 years ago

hi. Is this a problem with local files?

dimonovdd commented 2 years ago

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

smalgin commented 2 years ago

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...

dimonovdd commented 2 years ago

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: 1) VS 2019

2) provided project

3) Set up Emulator as shown (Essentially Pixel/R/30 with 4GB RAM and forced GPU) image

4) set up Google account there & make sure you have some images in your Google Drive app

5) Try to pick image from Drive. All is gray, you can only pick 'cancel'.

NOTE: Picking from Google Photos works!

MediaGallery.zip

dimonovdd commented 2 years ago

@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

smalgin commented 2 years ago

I thought so. Makes sense in your position. But why Xamarin.Essentials picker doesn't have this issue??? Mystery...

smalgin commented 2 years ago

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.

dimonovdd commented 2 years ago

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

mcblacksea commented 2 years ago

@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); 
softsan commented 1 year ago

anything else can be done on this?