0

In my app I'm taking pictures like this:

  public void OpenCam()
    {
        // Standard
        Intent intent = new Intent(MediaStore.ActionImageCapture);

        _newFile = new Java.IO.File(Storage.Instance.TmpImageFilePath);

        intent.PutExtra(MediaStore.ExtraOutput,
            FileProvider.GetUriForFile(Context, Context.PackageName + ".provider", _newFile));
        intent.AddFlags(ActivityFlags.GrantReadUriPermission);

        StartActivityForResult(intent, TakeImageRequest);
    }

after taking a picture and and confirm the taken picture with ✓ in the photo app, OnActivityResult is called and I can work with the data.

This worked fine for a few years.

Now, on my Samsung Galaxy Tab7 FE - Android 12, every ~third attempt fails. The app crashes on clicking the round button to take a picture (that's the moment when the Visual Studio debugger stops). No error, no exception, OnActivityResult is not called.

logcat: (orange marked is my app package name) enter image description here

and right before:

06-03 09:06:33.670  Samsung SM-T733 Info    1200    ActivityManager Process MYAPP (pid 28306) has died: prev LAST(511,287)

Edit: Devices I could test without this problem:

  • Huawei P30 lite (Android 8)
  • Huawei P30 Pro ( Android 10)
  • Samsung A52s 5G (Android 12)
  • Huawei Mediapad M5 lite (Android 8)
Aiko West
  • 791
  • 1
  • 10
  • 30
  • 1
    Review the Android Debug `logcat` output to determine why the OS is terminating the app: https://learn.microsoft.com/en-us/xamarin/android/deploy-test/debugging/android-debug-log?tabs=windows – SushiHangover Jun 02 '22 at 17:09
  • Unfortunately, I can't make sense of the logcat. Is there something you can say about it? – Aiko West Jun 03 '22 at 08:35
  • The logs shows a lot of influencing factors. We could not make sure which one. Could you check on other devices? Did this only occur on Samsung Galaxy Tab7 FE - Android 12? – Wendy Zang - MSFT Jun 06 '22 at 06:59
  • Hi @WendyZang-MSFT I just added the devices I could test. All without this problem – Aiko West Jun 07 '22 at 05:45
  • I guess it happened on specific device. – Wendy Zang - MSFT Jun 07 '22 at 06:16
  • any ideas for troubleshooting? – Aiko West Jun 07 '22 at 09:58
  • I was not able to reproduce. Could you check the code on other Android 12 devices? You could use emulators to make sure if it happened on Samsung Galaxy. – Wendy Zang - MSFT Jun 09 '22 at 05:45
  • I just read this post https://github.com/jamesmontemagno/MediaPlugin/issues/901 which says that the Samsung Camera App just takes the whole memory and tries to free memory by killing my app :/ also tried to set NoHistory to false like in this post https://stackoverflow.com/questions/44921337/xamarin-forms-android-crash-while-taking-photo-without-exception – Aiko West Jun 28 '22 at 07:36
  • Let's follow the issue on GitHub. – Wendy Zang - MSFT Jun 29 '22 at 07:08

0 Answers0