Forum Xamarin Xamarin.Forms

Can't take pictures with media nuget

Hello, I'm having an issue with some Android devices when I want to take a picture with the media plugin and the behavior is different depending on whether I'm debugging or in release mode.

In release mode I press the camera button, the camera appears and I take and accept the photo, and then the app shows the splash screen like starting and I could never take a photo.

To try to figure out what happens inside the media component I imported it into my project and debug it.
I press the camera button and then the code creates the intent inside the OnCreate in the class MediaPickerActivity, arrives at the end and after execute the function StartActivityForResult(intent, id) the app crashes without any exception or log in the output, nothing.

I'm reproducing this crashes with a Xiaomi A2 lite, but I know also happens with Huawei and Samsung S10/20.

I know the behavior is different but I think it must be related in someway, couldn't be coincidence.

Any ideas what could be happening?

Tagged:

Best Answer

  • jordiptjordipt Member
    Accepted Answer

    I've finally solved it. The problem was the way I was handleing the permissions. Now I let that media nuget do it and its all ok.

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    I'm reproducing this crashes with a Xiaomi A2 lite, but I know also happens with Huawei and Samsung S10/20.

    I did a test on my mobile (HuaWei mate30) with the sample of MediaPlugin, but I couldn't reproduce this question, it just works properly.

    Sorry,I don't have any of the phones you mentioned.(Xiaomi A2 lit and Samsung S10/20)

  • jordiptjordipt Member
    Accepted Answer

    I've finally solved it. The problem was the way I was handleing the permissions. Now I let that media nuget do it and its all ok.

  • jezhjezh Member, Xamarin Team Xamurai

    Congrats, and thanks for your supporting xamarin.

    Have a nice day. :)

Sign In or Register to comment.