Hi ,
In my xamarin form project i have a camera functionality implemented using Xam.Plugin.Media package as a custom renderer from android project. All operations works as expected but small issue when i press back button while camera is open first it shows the black screen. Is anybody has faced the same issue? Any workaround/Solution?
I'm using Xam.Plugin.Media version 2.6.0
Xamarin.Form version 2.3.2.127
@rakeshraghavan
If you are pressing back from camera screen without capturing photo then from Xam.Plugin.Media, In CameraPageRenderer class back pressed event is not handled.
This one worked for me,
If image is null, call device back pressed overriden event,
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
Name = "abcd-" + _count++ + ".jpg",
Directory = "Xyz",
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
});
if (file == null)
{
MainActivity.MainAppActivity.OnBackPressed(); //here
return;
}
MainAppActivity is activity instant, Initialised in MainActivity class
public static Activity MainAppActivity;
Answers
Same issues even for me also
@rakeshraghavan
If you are pressing back from camera screen without capturing photo then from Xam.Plugin.Media, In CameraPageRenderer class back pressed event is not handled.
This one worked for me,
If image is null, call device back pressed overriden event,
MainAppActivity is activity instant, Initialised in MainActivity class
public static Activity MainAppActivity;
Thanks