Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Xamarin.Forms.Labs camera service generates an error

$
0
0

We've been using Labs in our Xamarin.Forms PCL project for a while and we can't for the love of (insert-god-name-here-if-you're-not-atheist) find what caused this problem to happen.

Here's the error we get:

[ContextImpl] Failed to ensure directory: /storage/emulated/0/Android/data/Klaim.Droid/files/Pictures

Which happens when we try to take a picture (selecting one by browsing works)

We use Xamarin.Forms 1.3.1.6294-pre1 and Xamarin.Forms.Labs 1.2.1-pre2

Here's the code causing it:

private async Task<byte[]> TakePicture ()
{
    try {
        MediaFile _mediaFile = await this._mediaPicker.TakePhotoAsync(new CameraMediaStorageOptions {
            DefaultCamera = CameraDevice.Front,
            MaxPixelDimension = 1600
        });
        return StreamToByteArray(_mediaFile.Source);
    } catch (System.Exception ex) {
        //DisplayAlert ("Exception", ex.Message, "OK");//TODO: Can't call DisplayAlert in a ViewModel :(
        return null;
    }
}

It happens more specifically on this line: MediaFile _mediaFile = await...

Anyone can outsmart us on this one?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>