App Crashes when I am taking pictures on Android devices(Samsung tab and mobile)

Albin Lukose 45 Reputation points
2023-09-01T05:03:40.6566667+00:00

Media Picker Interface For Maui

Followed these steps to capture image in my android device(Samsung tablet and Samsung mobile phone with latest API).The app crashes frequently once you capture the image. Tried debugging but no information is retrieved while crashing. App crashes and restart by itself .Not able to replicate this issue in Emulator. This happens randomly. Sometimes it works sometimes not.

I have already added the necessary permissions for image capturing :

	<uses-permission android:name="android.permission.CAMERA" />
	<intent> 			
		<action android:name="android.media.action.IMAGE_CAPTURE" /> 
	</intent>

Is this something related to Code ?

 if (MediaPicker.Default.IsCaptureSupported)
        {
            FileResult photo = await MediaPicker.Default.CapturePhotoAsync();

            if (photo != null)
            {
                //do nothing
            }
        }

Is there any solution or alternate libraries available for image capturing so that I can capture safely ?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,497 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.