0

When I take Photo that save image, It will display sub layout choose "Retry" or "OK" for image. I don't want display it.

I use library Plugin.Media on Xamarin Forms and my code:

Handler event click button capture:

    private void CaptureImageCommandHandler()
    {
        Device.BeginInvokeOnMainThread(async () =>
        {
            try
            {
                await CheckPermissionCamera();

                if (Images == null)
                    Images = new ObservableCollection<string>();

                // Create a temp image. It'll be detelted after upload this temp image
                var path = await MediaManagement.TakePhoto();
                if (path == null)
                    return;

                // Add image
                AddImage(path, Localization.Resource.Photo);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
            }
        });
    }

Code of method TakePhoto():

    public async Task<string> TakePhoto(float? width = null, float? height = null)
    {
        try
        {
            await CrossMedia.Current.Initialize();
            var mediaFile = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions());
            if (mediaFile?.Path == null)
                return null;

            // This is: Taking a photo action
            var result = await ResizeImageFile(mediaFile.Path, width, height, true).ConfigureAwait(false);
            return result;
        }
        catch (Exception)
        {
            return null;
        }
    }

This is image of page.

Image Page

Please help me!

Thanks!

4

1 回答 1

1

根据这个答案,你不能使用 Plugin.Media 来做到这一点。

这个插件使用标准的方式在 Android 中捕获照片,它依赖于设备实际的相机应用程序。保存/重试功能是相机应用程序的一部分,我们无权访问它,因为这在 Android“供应商”之间会有所不同。

这意味着您需要找到解决此问题的方法。但是这个答案中也有一个链接,可以帮助你。希望能帮助到你!

于 2018-11-19T02:14:29.497 回答