Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Xamarin Forms Android Camera not working after update Android OS 11

AnbuMani27AnbuMani27 USMember ✭✭✭

Hi All,

I am facing issues on camera after updating to Android OS 11.

When i tried to read the value from android stored image file path, it returns NULL.

Same kind of issues were posted in the below blog.

Note: Same Code works Android OS 10.



  • AnbuMani27AnbuMani27 USMember ✭✭✭

    Working Code:

    var filePath = Droid.MainActivity.Instance.GetExternalFilesDir(Android.OS.Environment.DirectoryPictures).Path;
    Java.IO.File file;
    private void TakeAPicture(object sender, EventArgs eventArgs)
       var intent = new Intent(MediaStore.ActionImageCapture);
       file = new Java.IO.File(filePath, string.Format("Image_{0}.jpg", Guid.NewGuid()));
       (new Java.IO.File(filePath)).SetWritable(true, false);
       intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(file));
       StartActivityForResult(intent, 102);
    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        if (requestCode == 102 && resultCode == Result.Ok)
           byte[] imageByteArray = Utils.HandleRotationBitmap.GetRotatedImageByteArray(Forms.Context, file);
           if (imageByteArray != null)
  • Jon_DJon_D USMember

    Did you ever find a solution to this issue? I'm facing the same issue after updating to the Android 11 sdk.

Sign In or Register to comment.