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

Always returns "User cancelled image selection" if more then one camera app is installed on Android device

Open im-aditya opened this issue 6 years ago • 8 comments

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.25.2
  • react-native v0.60.5

Platform

Tell us to which platform this issue is related

  • Android

Expected behaviour

The openCamera function should resolve the promise with imageData.

Actual behaviour

The openCamera function always rejects the promise with error "User cancelled image selection"

Steps to reproduce

  1. Install another camera app in the Android device
  2. Then in the app with basic setup call openCamera function with following options object

{ width: 200, height: 200, cropping: false, cropperCircleOverlay: false, mirrorImage: true, compressImageQuality: 0.5, forceJpg: true, writeTempFile: false, includeBase64: true, }

  1. It should get resolved but it is always rejecting the promise

Attachments

// stacktrace or any other useful debug info

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

im-aditya avatar Oct 22 '19 16:10 im-aditya

Does it happen in every device? Here can not recreate the issue.

sadi304 avatar Nov 12 '19 05:11 sadi304

I think one more important thing is.. no default camera app should be set. I have tested on LG-H870DS with Android 8.0 and latest OnePlus-6 device. On both the devices its rejecting the promise.

im-aditya avatar Nov 12 '19 10:11 im-aditya

which other camera app did you use? I tested on my note9 it works fine though.

sadi304 avatar Nov 12 '19 11:11 sadi304

I have tried with 2 different apps. One is HD Camera (KX Camera Team). And another is Camera MX.

im-aditya avatar Nov 12 '19 11:11 im-aditya

I have tried with 2 different apps. One is HD Camera (KX Camera Team). And another is Camera MX.

maybe related to android version or something. I couldn't reproduce. I was interested as one user of a production app faced this type of issues, so tried to recreate it based on this.

sadi304 avatar Nov 12 '19 12:11 sadi304

react-native-image-crop-picker" "0.28.0 Samsung A8+ installed OpenCamera (in addition to stock-app).

If no default camera selected Picker throws: [Error: User cancelled image selection] {"framestopop":1,"nativestackandroid":[],"userinfo":null,"message":"user cancelled image selection","code":"e_picker_cancelled","line":5020,"column":45 }

After Camera set as default (Use any camera Always) - picker works as intended. Issue reproduces after "Default Camera" resets.

VBarzionov avatar Jun 16 '20 01:06 VBarzionov

I was facing the same problem. After looking into it, I found that, in my manifest file, main activity was being launched with android:launchMode="singleInstance". After changing it to android:launchMode="singleTop", the app was able to handle camera intents with multiple apps correctly.

Here is the doc with all launch modes information: https://developer.android.com/guide/topics/manifest/activity-element

julianrod94 avatar Aug 26 '20 15:08 julianrod94

<activity android:name=".MainActivity" android:launchMode="singleTop"

julianrod94 avatar Aug 26 '20 15:08 julianrod94