jamesmontemagno / Xamarin.Plugins

Cross-platform Native API Access from Shared Code!
MIT License
1.3k stars 380 forks source link

Media Plugin throws exception on TakePhotoAsync #288

Closed dodyg closed 8 years ago

dodyg commented 8 years ago

Please take a moment to fill out the following (change to preview to check or place x in []):

This is a

Which plugin does this impact:

Version Number of Plugin: 2.3.0 Device Tested On: Simulator Tested On: Xamarin Android Player

Expected Behavior

File saved to directory

Actual Behavior

System.IO.IOException: Win32 IO returned 25, path:/storage/emulated/0/Pictures/2016 12:18:01 pm.jpg

Steps to reproduce the Behavior

 if (CrossMedia.Current.IsCameraAvailable && CrossMedia.Current.IsTakePhotoSupported)
                {
                    // Supply media options for saving our photo after it's taken.
                    var mediaOptions = new Plugin.Media.Abstractions.StoreCameraMediaOptions
                    {
                        SaveToAlbum = true,
                        Name = $"{DateTime.UtcNow}.jpg"
                    };

                    // Take a photo of the business receipt.
                    var photo = await CrossMedia.Current.TakePhotoAsync(mediaOptions);
}
dodyg commented 8 years ago

On device it throws the same exception as well

jamesmontemagno commented 8 years ago

This issue was moved to jamesmontemagno/MediaPlugin#13

jamesmontemagno commented 7 years ago

Update here. This happens to be because you are specifying illegal characters for the file name. http://stackoverflow.com/questions/2679699/what-characters-allowed-in-file-names-on-android next version will fix this.