When using ImagePicker.showImagePicker, after granting permission for camera use selecting "Take a photo" does not open the camera.
On an Android 10 device (I used a Pixel 2 XL)
Find a place in the code to kick off ImagePicker.showImagePicker(), a button might be easiest
When the image picker kicks off, allow permissions for both camera and device storage
Ensure that the camera does not launch, even though it should
react-native info output:
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 166.34 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v10.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /Users/dustinmcrorie/.rvm/rubies/ruby-2.5.7/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 14.0.1 - /usr/bin/javac
Python: 2.7.17 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
*react-native*: Not Found
Library version: 2.3.3
ImagePicker.showImagePicker(), a button might be easiestDescribe what you expected to happen:
ImagePicker.showImagePicker({}, (response) => {
uploadFileFromResponse(response);
});
+1 A fix for this prior to Android 11 coming out of beta would be great.
+1 ⬆️ Fix for this would be great.
+1 arrow_up Fix for this would be great.
Hey
I was also facing the same issue along with gallery, so I found below mentioned solution. Although it seems like a temporary fix but can work meantime till the fix is done.
You just need to add the
under the Application Tag of AndroidManifest.xml
Refer to this comment for the above mentioned solution: https://github.com/react-native-community/react-native-image-picker/issues/1233#issuecomment-561349254.
Hey
I was also facing the same issue along with gallery, so I found below mentioned solution. Although it seems like a temporary fix but can work meantime till the fix is done.You just need to add the
under the Application Tag of AndroidManifest.xml
Refer to this comment for the above mentioned solution: #1233 (comment).
@NMahendroo This solution will be deprecated as of Android 11 (this line in the manifest will be ignored), so a more permanent solution will still need to be found.
Hey, same for me with RN 0.63.2 and 2.3.3. Camera did not open and Logical say's "Permission denied".
With this option android:requestLegacyExternalStorage="true" it works at the moment.
+1 a fix for this pleaaase!
+1 for a proper fix for this would be great.
+1 a fix for this
works now with - android:requestLegacyExternalStorage="true" against SDK 29
targetSdkVersion = 29
compileSdkVersion 29
buildToolsVersion = "29.0.3"
+1 a fix for this
works now with - android:requestLegacyExternalStorage="true" against SDK 29
targetSdkVersion = 29
compileSdkVersion 29
buildToolsVersion = "29.0.3"
I used this solution it worked on development, when deployed to internal test on google play and install from the store it didn't work
F
+1 for this :), really need targetSdkVersion from 28 to 29 :).
+1
+1
+1 a fix for this
works now with - android:requestLegacyExternalStorage="true" against SDK 29
targetSdkVersion = 29
compileSdkVersion 29
buildToolsVersion = "29.0.3"I used this solution it worked on development, when deployed to internal test on google play and install from the store it didn't work
@AllanKlaus I installed the app to the Google Play Internal App Sharing too but was able to get the Camera and Photos to open with this setting. However, I was not able to upload the actual image. Not sure if this issue is directly related with Image Picker or the latest version of React Native (0.63.2).
+1
+11111111111111111111111111
+1
Please stop spamming the issue with +1 comments.
If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.
Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
requestLegacyExternalStorage flag as mentioned here: https://github.com/react-native-community/react-native-image-picker/issues/1233#issuecomment-561349254
lower your targetSDK to version 28 (android/build.gradle):
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
A possible workaround (if you don't need your pics to be public) is to use the privateDirectory flag:
storageOptions={{ privateDirectory: true }}
Please stop spamming the issue with
+1comments.
If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
requestLegacyExternalStorageflag as mentioned here: #1233 (comment)- lower your targetSDK to version 28 (
android/build.gradle):buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28
Maybe it's worth to the Readme file?
Please stop spamming the issue with
+1comments.
If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
requestLegacyExternalStorageflag as mentioned here: #1233 (comment)- lower your targetSDK to version 28 (
android/build.gradle):buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28
you are a life savior, thank you
Please stop spamming the issue with
+1comments.
If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
1. `requestLegacyExternalStorage` flag as mentioned here: [#1233 (comment)](https://github.com/react-native-community/react-native-image-picker/issues/1233#issuecomment-561349254) 2. lower your targetSDK to version 28 (`android/build.gradle`):buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28
I receive a notification from google and new apps will not accept target version less than 29 and how don't use it yet will need to upgrade.
Please stop spamming the issue with
+1comments.
If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.
Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
requestLegacyExternalStorageflag as mentioned here: #1233 (comment)- lower your targetSDK to version 28 (
android/build.gradle):buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28Maybe it's worth to the Readme file?
Worked perfectly! Thank you for that!
@AllanKlaus any solution or workaround?
You can try following this comment.
@iagormoraes I suppose your pull-request (#1439) also fixes this issue along with the ones you already commented on?
But lowering the target sdk version is not a solution given that Google Play will reject app:
Note: From 2 November 2020, app updates must target Android 10 (API level 29) or higher.
https://developer.android.com/distribute/best-practices/develop/target-sdk
@LohithaYalavarthi1 no I could not find a solution yet.
@AllanKlaus I have resolved this issue, for target SDK version 29 by the provided link answer, because for my case requestLegacyExternalStorage didn't work either
https://github.com/ivpusic/react-native-image-crop-picker/issues/1110
+1
What does it mean when people comment +1? Is there any hidden meaning in +1 or it just spams?
I don't see any valuation here.
You can try following this comment.
@iagormoraes I suppose your pull-request (#1439) also fixes this issue along with the ones you already commented on?
Exactly, it is a solution for android 10+ issues to open camera or the image gallery.
for temporarily fix, you can point to my fork in package.json
The issue can be related to new package visibility (https://developer.android.com/about/versions/11/privacy/package-visibility).
After all updates (at least Android Studio 4.1) try to add in your manifest <queries> that shows what action is required in app.
In my case problem disappears when adds.
IMAGE_CAPTURE -> CAMERA,
GET_CONTENT -> GALLERY (to get files change mimeType if you want video)
PICK -> GALLERY (should change mimetype if u want video)
CHOOSER -> GALLERY (if someone have other image browsers)
You can also check in logcat what queries you have to add (should contains "BLOCKED" or "no permission".
Error is because ImagePickerModule when you don't have permission in Intent with resolveActivity returns null (u can comment it to check better errors in startActivityForResult)
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
<data android:mimeType="image/*" />
</intent>
<intent>
<action android:name="android.intent.action.PICK" />
<data android:mimeType="image/*" />
</intent>
<intent>
<action android:name="android.intent.action.CHOOSER" />
</intent>
</queries>
I hope that can help you
Hey, same for me with RN 0.63.2 and 2.3.3. Camera did not open and Logical say's "Permission denied".
With this option android:requestLegacyExternalStorage="true" it works at the moment.
thanks sir. Great idea!
Most helpful comment
Please stop spamming the issue with
+1comments.If you are experiencing the same problem, and don't have anything valuable to add, use reaction instead.
Spamming the issue only makes it difficult to find valuable comments which could actually help with fixing the issue.
As of now, there are 2 workarounds before a proper fix is provided:
requestLegacyExternalStorageflag as mentioned here: https://github.com/react-native-community/react-native-image-picker/issues/1233#issuecomment-561349254lower your targetSDK to version 28 (
android/build.gradle):