From last few hours, I am trying to make a button, on button click the camera will open. I test it only UWP and it's not working as expected.
I tried with x64 and x86 both in UWP( to make sure it's not a platform related issue).
private async void Button_Clicked(object sender, EventArgs e)
{
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
DisplayAlert("No Camera", ":( No camera available.", "OK");
return;
}
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
Directory = "Sample",
Name = "test.jpg"
});
}
the project is .net standard in 2017, Visual Studio has created the project in xamarin 3.0 and I test it in 2.4 too, nothing is shown yet.
in first few time my breakpoint was hitting in my xamarin.forms project but suddenly they stopped, Maybe it's async thing. Currently, when I debug and put breakpoint it navigates to app.xaml.cs and put my breakpoint there.
For testing it in a shared project, I created a testing project and put my code there, in that code my code in UWP was firing but nothing is opened (C# code didn't make any exception at runtime).
This project that I take my code from is .net standard in 2017, Please check and help, I am trying to solve it from last few hours.