Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Camera permission error Android 13 api 33 #955

Open
BDPRICA opened this issue Feb 9, 2023 · 6 comments
Open

Camera permission error Android 13 api 33 #955

BDPRICA opened this issue Feb 9, 2023 · 6 comments

Comments

@BDPRICA
Copy link

BDPRICA commented Feb 9, 2023

When opening the camera with Android 13 api 33, the following error is displayed: Camera permission(s) are required.
at Plugin.Media.MediaImplementation.TakePhotoAsync (Plugin.Media.Abstractions.StoreCameraMediaOptions options, System.Threading.CancellationToken token)

The permissions that are assigned are:







Img_error

The code to test is the following:
public async Task Evento_tomar_foto()
{
string basef1 = "";
try
{
await CrossMedia.Current.Initialize();

            if (CrossMedia.Current.IsCameraAvailable && CrossMedia.Current.IsTakePhotoSupported)
            {
                // Take a photo of the business receipt.
                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    SaveToAlbum = true,
                    Name = $"{DateTime.UtcNow}.jpg",
                    CompressionQuality = 80,
                    MaxWidthHeight = 250

                });
                if (file != null)
                {
                    //Convertir a base 64
                    FileStream fs = new FileStream(file.Path, FileMode.Open, FileAccess.Read);

                    byte[] ImageData = new byte[fs.Length];

                    fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length));

                    fs.Dispose();

                    basef1 = Convert.ToBase64String(ImageData);//Guarda la img en base64  
                }
            }
        }
        catch(Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        
        return basef1;
    }
@kevinderycke
Copy link

Same issue even if I asked for READ_MEDIA_IMAGES permission. I have not found any workaround.

@nk-alex
Copy link

nk-alex commented Mar 25, 2023

Same here. Works as expected for api 32

@ArpitViradiya
Copy link

This issue is fixed in 6.0.1-beta.

@ChristianM66
Copy link

HI James, thanks for your work and the information. When will version 6.0.1 be released.

@Digifais
Copy link

HI James, thanks for your work and the information. When will version 6.0.1 be released.

6.0.1 is available as pre-release package on NuGet: https://www.nuget.org/packages/Xam.Plugin.Media/6.0.1-beta

@DaviBittencourt
Copy link

When will version 6.0.1 be released ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants