Closed ilyakamens closed 4 years ago
Update: I figured it out. We explicitly don't have the <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
permission in our AndroidManifest.xml
. Specifically, we have a Cordova build hook that removes it, since we don't want to have to add that permission to our already-live app.
From looking at https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java#L253, it appears we shouldn't actually need that permission to use this plugin if we just want to take a picture and not use the camera roll (i.e., just store the picture in Local Storage).
I think I'll have to fork this plugin to remove requesting that permission if I want to be able to use it without adding the WRITE_EXTERNAL_STORAGE
permission to our app.
WRITE_EXTERNAL_STORAGE
permission to AndroidManifest.xml
? If not, would be great to add.Thanks!
I can only respond to one of these, as it is visible from the code:
3. Did I miss something in the documentation that says we need to add the
WRITE_EXTERNAL_STORAGE
permission toAndroidManifest.xml
? If not, would be great to add.
The plugin adds this permission by default: https://github.com/apache/cordova-plugin-camera/blob/eed44330a45daefea4897eafe913838b0f8cfa67/plugin.xml#L60 So removing it might of course cause problems. (Which doesn't mean that the plugin couldn't be refactored in a way that would not make this necessary)
Thanks. I'll either refactor and submit PR or fork. Sorry for the noise!
Actually not noise at all, very valid questions. I would actually say let's keep the issue open for a bit to see if you can get real answers from actual users of the plugin. I "only" do issue triage ;)
Is it just me or this permission is really missing in the AndroidManifest.xml when using this plugin:
<uses-permission android:name="android.permission.CAMERA" />
Any way to fix it ? Adding <uses-permission android:name="android.permission.CAMERA" />
doesn't change anything for me.
Same issue on android 8.1.0
& cordova-plugin-camera 4.1.0 "Camera"
navigator.camera.getPicture(onSuccess, onFail, options);
onFail
with message length=1; index=1
@QuentinIcky same with me are you fix it?
@AmrAlmagic nope sorry :(
Having the same issue with cordova 9.0. The camera return 20 when try to access Gallery or take picture. Is there a fix for this?
Having the same issue with cordova 9.0. The camera return 20 when try to access Gallery or take picture. Is there a fix for this?
Same, I am on Cordova 9.0 (on Ionic 3.9.9) and trying to take a picture was resulting in an error 20. I then simply added the following permission to my config.xml and I was able to take a picture.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Also, if this can help, I didn't need to use the cordova-plugin-android-permissions.
Hope this helps!
This solution does not work for me. I have tried adding the permission and i get the same error.
This solution does not work for me. I have tried adding the permission and i get the same error.
Changing TargetSdkVersion from 33 to 32 worked for me
Bug Report
Problem
I'm unable to launch the camera on Android.
What is expected to happen?
The camera should launch.
What does actually happen?
The error callback is called with a value of
20
, which I believe isPERMISSION_DENIED_ERROR
: https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java#L98Information
It's the only call I make on the page (after device is ready, of course).
Command or Code
Environment, Platform, Device
I've tried on an LG K20 PLUS running Android 7.0 and a Galaxy S9 running Android 9.
Version information
Mac OS X 10.14.5
Checklist