Hello Team plz. help me. All details add in View Log File plz. check it
View Log
<plugin name="cordova-plugin-camera" spec="6.0.0">
<!-- Permissions for Android -->
<variable name="CAMERA_USAGE_DESCRIPTION" value="Allow camera access for taking photos" />
<variable name="ANDROID_CAMERA_PERMISSION_DESCRIPTION" value="Allow camera access for taking photos" />
</plugin>
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>need camera access to take pictures</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to get pictures from there</string>
</edit-config>
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
<edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to save pictures there</string>
</edit-config>
<engine name="android" spec="12.0.0" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-targetSdkVersion" value="33" />
$cordovaCamera.getPicture(options).then(movePic, function (imageData) {
window.resolveLocalFileSystemURI(imageData, function (fileEntry) {
$scope.picData = fileEntry.nativeURL;
$scope.ftLoad = true;
});
}, function (err) {
console.error(err);
});
ghenne
August 13, 2023, 10:41am
2
Where does the Error 20 appear? It’s not in the log.
There is an open issue for cordova-plugin-camera concerning API 33. Could this be the same problem? It’s something the maintainers of the plugin will need to fix.
Permissions from Android 13
<uses-permission android:name="android.permission.ACTION_CREATE_DOCUMENT" />
<uses-permission android:name="android.permission.ACTION_OPEN_DOCUMENT" />
Cordova camera not open, Getting error code 20 Add permission then Problem are resolved
ghenne
August 14, 2023, 11:40am
4
Thank you for posting this solution - it’s sure to help others!
Hello what is the correct way to inform these permissions on config.xml
I’ve added on a config-file section and still have the error 20.
I’ve also added the androidx-core-version as plugin mantainers say on his git site.
Any help will be appreciated
<plugin name="cordova-plugin-camera" >
<variable name="ANDROIDX_CORE_VERSION" value="1.8.0" />
</plugin>
<config-file after="uses-permission" parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACTION_CREATE_DOCUMENT" />
<uses-permission android:name="android.permission.ACTION_OPEN_DOCUMENT" />
</config-file>
ghenne
August 22, 2023, 11:54am
6
It looks like this is an open issue with that plugin . The maintainers of it are working on it.
LeChoa
August 22, 2023, 6:37pm
7
Hi there,
I’m almost in the same situation as @isantaulariamuixi , config-file does not work and edit-config overrides all permissions (like there is no more internet permission).
So if someone could elaborate on this, maybe @ghenne , please.
Thanks you guys anyway for the support.
ghenne
August 22, 2023, 7:38pm
8
The problem is that the plugin has not been updated for the new version of Android. These plugins are made and maintained by third parties - they are not something we are able to fix or support.
Thank you all, I will be tracking plugin updates and notify when it is fixed.
LeChoa
August 23, 2023, 5:51pm
10
Hi,
I have published on npm a fix found here: Error Code 20 on Android · Issue #826 · apache/cordova-plugin-camera · GitHub
This is just a workaround from DaedalusDev waiting for the plugin to be updated.
The package repo is: cordova-plugin-camera-flossy - npm and it is already approved by VoltBuilder’s team so feel free to use it…
Thanks again.
1 Like
Thank you all. With the daedalusDev workaround it is all working and could update our app.
I will wait to check camera 7.0 when is released.