Add location information to captured images

木幡 弘文 1 Reputation point
2021-11-08T02:42:56.917+00:00

I'm starting the camera by using Plugin.Media.CrossMedia.Current.

How can I add location information?

I also want to shoot continuously, do I need to write it separately?

I have been able to shoot and save, but please tell me how to add location information and shoot continuously.

private async void OnImageClicked()
        {

                await Plugin.Media.CrossMedia.Current.Initialize();

                if (!Plugin.Media.CrossMedia.Current.IsCameraAvailable || !Plugin.Media.CrossMedia.Current.IsTakePhotoSupported)
                {
                    return;
                }

                DateTime dt = DateTime.Now;
                string result = dt.ToString("yyyyMMddHHmmss");
                result += ".jpg";

                Plugin.Media.Abstractions.MediaFile file = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    Name = result
                });

                if (file == null)
                {
                    return;
                }

                Queue<byte> bytes = new Queue<byte>();
                using (Stream s = file.GetStream())
                {
                    long length = s.Length;
                    int b;
                    while ((b = s.ReadByte()) != -1)
                    {
                        bytes.Enqueue((byte)b);
                    }
                }

                File.Copy("XXXXXXXXX/Pic");

                PicPoint.Add(result);

                file.Dispose();

        }
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,379 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.