0

I have a feature to build wherein I want to allow a user to take multiple photos one by one until the user decides to stop. Currently, I was able to open a camera intent and allow the user to take a photo, once the photo is clicked the app asks to either save or retake a photo. But the requirement is to take multiple photos ie. one the camera is open the user can take as many pictures as he wants.

I know its a duplicate as this but it did not help as it gives links to Android libraries but I cannot find those libraries for Xamarin Android. Any links to android-xamarin would help.

I also took a look at openeing the camera intent in a loop but in my case its not possible as there is no way to know how many pictures the user is going to take.

Arti
  • 2,993
  • 11
  • 68
  • 121

1 Answers1

0

I have the same requirement but settle with the loop option since I could not find a better way to achieve this. To help you with the loop problem, you could just use a while loop to keep the camera app opening until use press cancel.

while (true)
{
    var file = await CrossMedia.Current.TakePhotoAsync(
        new StoreCameraMediaOptions
        {
            Directory = "Test",
            SaveToAlbum = true,
            CompressionQuality = 75,
            CustomPhotoSize = 50,
            PhotoSize = PhotoSize.MaxWidthHeight,
            MaxWidthHeight = 2000,
            DefaultCamera = CameraDevice.Rear
        }
    );
    if (file == null)
    {
        return;
    }
    selected_images.Add(file.Path);
}
Manoj De Mel
  • 927
  • 9
  • 16