ionic-team / ionic-docs

https://ionicframework.com/docs
Apache License 2.0
580 stars 2.95k forks source link

bug: capacitor/ionic application able to access camera and store image without asking permission. #2821

Open JefinDX opened 1 year ago

JefinDX commented 1 year ago

URL

https://ionicframework.com/docs/react/your-first-app/deploying-mobile

Issue Description

I was following the photo-gallery app tutorial step by step.

When I did the build apk step in Android Studio, I forgot to add the permission xml into AndroidManifest.xml file.

But strangely, all the functionalities of the application worked as expected (camera, photo storage functionality). I couldn't understand this behavior from the android app. Could someone guide me what I am missing here. Thanks.

thetaPC commented 1 year ago

Thank you for the issue! I was able to reproduce it and the team will look into this. It seems that Android has updated their permissions.

jcesarmobile commented 9 months ago

Those permissions are needed if saveToGallery is set to true, which was the default value on Capacitor v1 for Android, but was changed to false in Capacitor v2, so it's no longer needed unless the code explicitly sets saveToGallery to true. It's also needed if instead of taking a picture from the camera, you pick an existing image from the gallery, but the guide doesn't do that, so the Android permissions section could be removed for the angular, vue and react guides.

In case it wants to be kept, the information is out of date a a new permission is needed for Android 13

https://capacitorjs.com/docs/apis/camera#android