Closed joeykang closed 1 year ago
Hi 1) Have you tested this on a real device or simulator? 2) Can you provide a sample?
Hi
- Have you tested this on a real device or simulator?
- Can you provide a sample?
This is the snippet to get photo from the device. if clause did not get caught when selecting a photo from Photos(app). As you see in the screenshot, 'results' and 'capturedPhotos' variables were not null. But it gets photos correctly from other places like 'Download' folder.
var results = await MediaGallery.PickAsync(1, MediaFileType.Image); // Allow only one selection
capturedPhotos = results?.Files?.ToArray();
if (capturedPhotos != null && capturedPhotos.Count() == 1)
{
filePath = await LoadPhotoAsync(capturedPhotos[0]);
capturedPhotos[0].Dispose();
}
Updates: Got the same issue on Android emulator(API 30)
I can't reproduce this issue. Can you send me a small sample project?
I can't reproduce this issue. Can you send me a small sample project?
I tested it again with a small sample app and this issue was not happening. I compared related codes between the sample app and my app but I could not find any significant differences. Only thing I observed was OnActivityResult() got called with resultCode 'cancelled' in my app. Whereas, for the sample, OnActivityResult() returns with resultCode 'ok'. This means, in my app, picking a photo from Photos makes OnActivityResult() with failed Result. Any ideas?
protected override void OnActivityResult(int requestCode, Result resultCode, Intent intent)
{
if (NativeMedia.Platform.CheckCanProcessResult(requestCode, resultCode, intent))
NativeMedia.Platform.OnActivityResult(requestCode, resultCode, intent);
base.OnActivityResult(requestCode, resultCode, intent);
}
Maybe there are differences in project settings? AndroidManifest, csproj and etc.
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)
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!
Good user, I deserve a cookie! :)
Try to pick image from Drive. All is gray, you can only pick 'cancel'.
https://github.com/dimonovdd/Xamarin.MediaGallery/issues/87#issuecomment-1006673216
I have closed this issue, Discussions related to Google Drive will be discussed in a separate issue: #87
Maybe there are differences in project settings? AndroidManifest, csproj and etc.
Tried changes for AndroidManifest.xml, csproj and AssemblyInfo.cs but no luck. Frustrating.
Maybe can you give me access to your project?
Maybe can you give me access to your project?
Sorry it's not open project.
Same issue when moving to API 30 from 29. It worked before doing this.
@matthewyoungias Can you give a sample project?
need more information
Description
Unable to pick photos from Gallery(Photos app) on Android. But picking photos from other places like Download works correctly.
Actual Behavior
If I pick a photo from Gallery(Photos app) it returns empty result, not crash.
Expected behavior
It should return selected photo as a result.
Steps to reproduce the behavior
Screenshots or Videos
Reproduction Link
Configuration