Closed apivovar closed 8 years ago
I had a similar issue with TakePhotoAsync. Turns out the permissions wheren't set / asked for (in my case).
Using:
var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);
if (status != PermissionStatus.Granted)
{
await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Camera);
var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] {Permission.Camera});
status = results[Permission.Camera];
}
if (status == PermissionStatus.Granted)
{
... use take photo here
}
Solved it on my part.
This issue was moved to jamesmontemagno/MediaPlugin#21
This is a
Which plugin does this impact:
Version Number of Plugin: 2.3.0, 2.4.0-beta2 Device Tested On: Android 5.1.1 (Nexus 4) Simulator Tested On:
Expected Behavior
It should show Gallery image picker at least. However it does nothing, because of the exception caught in MediaPickerActivity.cs file:
Looks like this issue is reproduced since Android Lollipop.
Actual Behavior
await CrossMedia.Current.PickPhotoAsync() returns null
How to fix
Please, replace Intent.ActionPick with Intent.ActionGetContent all over the code of the plugin (MediaImplementation.cs and MediaPickerActivity.cs files). ACTION_GET_CONTENT provides more useful user interface.