react-native-multiple-image-picker icon indicating copy to clipboard operation
react-native-multiple-image-picker copied to clipboard

Camera not working in Android

Open truongcoino1 opened this issue 3 years ago • 11 comments

I am using library in android. With: await MultipleImagePicker.openPicker({mediaType: 'image'})

  • Camera button in first row not open camera here!! Please help me!

truongcoino1 avatar Dec 03 '21 17:12 truongcoino1

@baronha need your help, i am facing same issue.

rajatkumarsahu avatar Dec 09 '21 08:12 rajatkumarsahu

add options

        usedCameraButton: true,
        allowedVideoRecording: true,

filipef101 avatar Dec 09 '21 09:12 filipef101

@filipef101 usedCameraButton is to show camera, camera is visible but nothing happen on click. And i only need to allow images, not video

rajatkumarsahu avatar Dec 09 '21 09:12 rajatkumarsahu

You probably reject camera permission so it wont ask again or missed adding usage description to info plist

filipef101 avatar Dec 09 '21 09:12 filipef101

It is not working in OnePlus mobile device, working in all other android device. FYI: @filipef101 @baronha

rajatkumarsahu avatar Dec 10 '21 06:12 rajatkumarsahu

Something to raise in https://github.com/LuckSiege/PictureSelector Can you also send log cat And, does it occur also with this apk ? https://github.com/LuckSiege/PictureSelector/raw/master/app/demo/demo_2021-11-14_122603_v2.7.3-rc10.apk

filipef101 avatar Dec 13 '21 13:12 filipef101

it is working fine in above demo apk, i did not have one plus device and my apk is not breaking, only camera is not opening on click on camera.

rajatkumarsahu avatar Dec 14 '21 07:12 rajatkumarsahu

The issue is package visibility in Android R (api 30), just put the below codes into AndroidManifest.xml then the camera should work.

<uses-feature android:name="android.hardware.camera.any" />

<queries package="${applicationId}">
    <intent>
        <action android:name="android.media.action.IMAGE_CAPTURE" >

        </action>
    </intent>
    <intent>
        <action android:name="android.media.action.ACTION_VIDEO_CAPTURE" >

        </action>
    </intent>
</queries>

yong-ling avatar Dec 20 '21 06:12 yong-ling

wow. I used this way, my app shows camera but it crashes and shows image full of chinese text. What is the reason, tell me. Thank you very much!!

truongcoino1 avatar Dec 20 '21 15:12 truongcoino1

wow. I used this way, my app shows camera but it crashes and shows image full of chinese text. What is the reason, tell me. Thank you very much!!

Can you share the crash logs here?

yong-ling avatar Dec 20 '21 23:12 yong-ling

The issue is package visibility in Android R (api 30), just put the below codes into AndroidManifest.xml then the camera should work.

<uses-feature android:name="android.hardware.camera.any" />

<queries package="${applicationId}">
    <intent>
        <action android:name="android.media.action.IMAGE_CAPTURE" >

        </action>
    </intent>
    <intent>
        <action android:name="android.media.action.ACTION_VIDEO_CAPTURE" >

        </action>
    </intent>
</queries>

This solution worked well, thanks @yong-ling!

@baronha The documentation needs a urgent update, because any Android api above 29 worked well without add these codes into AndroidManifest.xml.

Vickout avatar Apr 22 '22 14:04 Vickout