Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Xam.Plugin.Media- why it requests a storage permission when taking photos on Android?

MikilllMikilll Member ✭✭✭
edited February 2020 in Xamarin.Forms

Hello,
I am using Xam.Plugin.Media from James Montemagno (https://github.com/jamesmontemagno/MediaPlugin)

When calling TakePhotoAsync() on Android Marshmallow or higher it requests two permissions: Camera (correct) and storage (incorrect). Why it is working like that? The storage permission should not be needed at all. I want just to take a photo. Just the camera permission should be sufficient.

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    When taking a photo, the ptoto will be saved to the album which comes to user privacy. So we need to add the WRITE_EXTERNAL_STORAGE and request the permission on Android 6.0 or higher.

    Check the source code of the method:
    https://github.com/jamesmontemagno/MediaPlugin/blob/master/src/Media.Plugin/Android/MediaImplementation.cs

  • MikilllMikilll Member ✭✭✭

    @Jarvan
    But I don't want the photo to be saved to the album. I just want to save the photo in my app.

    This plugin has an option SaveToAlbum which by default is false, so it should not request storage permission.

  • ImproveMeImproveMe Member ✭✭✭
    edited February 2020

    @Mikilll
    you are right, but because of vulnerability you as a developer could set the SaveToAlbum to true or save to a other path like you said "I just want to save the photo in my app" therefore you are saving physically in a filesystem on the device or in your cloud.

Sign In or Register to comment.