Closed lydongray closed 3 years ago
cordova-plugin-camera is not compatible with SDK 30 yet, specifically with the package visibility feature, next release will
You can install the plugin from github or add a queries
entry in your AndroidManifest.xml
like what this PR added
https://github.com/apache/cordova-plugin-camera/commit/abfbbd35d570f8bf60c3bcaa5a930cb74fdb5eac
I'm submitting a bug report [X] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/
Current behavior:
I'm not sure exactly where to post this as I can't determine the source of the issue so I'll drop a line here and see if I get a bite. When using Capacitor and calling @ionic-native/camera/ngx getPicture(), the devices asked for permission and when pressing Accept, the camera does not appear. You don't even get an error. Nothing happens. I have tested this on API 28, 29 and 30 and the problem seems to only exist on API 30.
Expected behavior: The camera should appear so a photo can be taken.
Steps to reproduce:
init project (there seems to be an issue with adding Capacitor at this stage so I add this manually later) $ ionic start test-camera-cap blank --type=angular $ cd test-camera-cap
install dependencies $ npm install cordova-plugin-camera @ionic-native/camera @ionic-native/core @capacitor/core @capacitor/cli @capacitor/android
init Capacitor $ npx cap init
ionic.config.json
src/app/home/home.page.html
src/app/home/home.page.ts
src/app/app.module.ts
$ ionic build $ ionic cap add android $ npm install jetify $ npx jetifier $ npx cap sync android $ ionic cap copy android
$ ionic cap open android
emulate in API 30 device and test camera functionality
Related code:
Other information:
Adding Capacitor while initializing the project causes errors when trying to add the Android platform. Because of this, I configure Capacitor once the project has been created. I also tested this with Cordova and couldn't replicate the issue. Is this an issue with Capacitor or something else?
Cordova test: $ ionic start test-camera-cordova blank --type=angular don't enable capacitor $ cd test-camera-cordova $ ionic cordova plugin add cordova-plugin-camera $ npm install @ionic-native/camera @ionic-native/core add source code $ ionic build $ ionic cordova platform add android $ ionic cordova emulate android --target Nexus 5 API 30
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):