jamesmontemagno / MediaPlugin

Take & Pick Photos and Video Plugin for Xamarin and Windows
MIT License
711 stars 360 forks source link

Camera not open first Time XF Android with Xamarin.Essentials #800

Open MRomeror opened 4 years ago

MRomeror commented 4 years ago

ONLY Post issues against Latest Beta!!!

Make sure you follow all of the setup directions before posting an issue: https://github.com/jamesmontemagno/MediaPlugin#important-permission-information

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 4.4.10-beta Device Tested On: LG Nexus 5X Android 8.1.0 Simulator Tested On: Version of VS: VS for Mac 8.4 (build 2657) Version of Xamarin: 4.4.0.991265 Versions of other things you are using: Plugin.CurrentActivity (2.1.0.4), Xamarin.Essentials (1.3.1)

Steps to reproduce the Behavior

G1.- Download the example that is in the plugin repository 2.- Update all nuget and Xam.Plugin.Media to version 4.4.10-beta 4.- If we launch the project on an android device the result is correct 5.- We install Xamarin.Essentials 6.- Uninstall and launch the project on an android device, the result is that the camera does not open at first

Expected Behavior

  1. Check Permission Camera and ReadExternalStorage
  2. await CrossMedia.Current.TakePhotoAsync(options)
  3. showing camera.

Actual Behavior

  1. Check Permission Camera and ReadExternalStorage
  2. await CrossMedia.Current.TakePhotoAsync(options)
  3. First time not showing camera.
  4. Repeat step 2
  5. showing camera.

    Code snippet

    ` private async Task TapTakePhoto() { if (CheckCameraPermission() && CheckFilePermission()) { var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { Directory = "Documents", SaveToAlbum = true, CompressionQuality = 92, PhotoSize = PhotoSize.Medium, DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Rear, Name = "document_img.png" });

            if (file == null)
                return;
            byte[] b = System.IO.File.ReadAllBytes(file.Path);
            string fichero64 = GlobalElements.BuildFieldFile(b, file.Path);
        }

    }`

    Screenshots

alexgg94 commented 4 years ago

Any updates on this?

lijusparkt commented 4 years ago

This plugin uses the Xamarin.Essentials, please follow the setup guide: http://aka.ms/essentials-getstarted

arqueror commented 3 years ago

Fixed this by downgrading Xamarin.Essentials to v1.6.0 while using Plugin.Media v5.0.1