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!

Huu Bao Nguyen
  • 1,051
  • 2
  • 14
  • 40

1 Answers1

1

According to this answer, you can't do it using Plugin.Media.

This plugin use the standard way of capturing photos in Android which rely on the device actual camera app. The save/retry functionality is part of the Camera App and we don't have access to it as this will be different between Android "providers".

That means you need to find a way around this issue. But also there is a link in this answer, that could help you. Hope it helps!