Bug 16276 - Xamarin.Mobile image capture on Galaxy S4 running 4.3 causes activity restart when rotated
Summary: Xamarin.Mobile image capture on Galaxy S4 running 4.3 causes activity restart...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.10.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Radek Doulik
Depends on:
Reported: 2013-11-15 14:47 UTC by Ryan E
Modified: 2013-11-18 13:10 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ryan E 2013-11-15 14:47:45 UTC
I don't have a lot of information at the time on this issue as I wasn't able to find anything in a logcat.

Basically what happens is when using Xamarin.Mobile to take an image using TakePhotoAsync. When the camera exits and returns to my activity it causes my activity to restart.

This behavior is only present on Galaxy S4 phones running Android 4.3, when the phone is rotated to the left when taking the photo. (All other orientations work, and all other devices I've tested seem to work fine as well)

This code also worked fine on the Galaxy S4 before 4.3 and the recent camera firmware update.

Using the regular Android method for capturing an image works fine (Calling the capture intent and listening on OnActivityResult)
Comment 1 Jonathan Pryor 2013-11-15 16:03:41 UTC
@Ryan: Would it be possible for you to provide a small testcase?
Comment 2 Ryan E 2013-11-15 16:08:00 UTC
The code I am running is as follows.

public static Task<MediaFile> CaptureImageAsync(Context context)
  var mediaPicker = new Xamarin.Media.MediaPicker(context);

  var options = new Xamarin.Media.StoreCameraMediaOptions
    DefaultCamera = Xamarin.Media.CameraDevice.Rear
    , Name = "temp.jpg"

  return mediaPicker.TakePhotoAsync(options);

The code that calls this:

protected async void CaptureBarcodesUsingCamera()
    var barcodeImage = await ImageBarcodeDecodingHelper.CaptureImageAsync(this);
Comment 3 Ryan E 2013-11-15 16:27:15 UTC
Just found that I was not using the latest Xamarin.Media. I was on version 0.6.3, I switched to version 0.7 using the GetTakePhotoUI helper method instead of TakePhotoAsync and this has resolved the issue.

My apologies for the bug report.
Comment 4 Jonathan Pryor 2013-11-18 13:10:13 UTC
Closing as INVALID as per Comment #3.