我添加了Xam.Plugin.Media来捕获图像。问题是,如果有SD卡并且不固定在内部存储器中,我想将图片保存到SD卡中。如何检查是否存在SD卡?如果可以的话,如何获取目录?
下面的代码是捕获图像的功能
try
{
var cafNo = entCafNo.Text;
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
await DisplayAlert("No Camera", "No Camera Available", "Ok");
return;
}
var file = await CrossMedia.Current.TakePhotoAsync(
new StoreCameraMediaOptions
{
SaveToAlbum = true,
Name = cafNo + "_IMG_01.png",
CompressionQuality = 80,
PhotoSize = PhotoSize.Medium,
DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Front
}
);
entPhoto1Url.Text = file.Path;
}
catch (Exception ex)
{
Console.Write(ex.Message);
}