ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.26k stars 1.01k forks source link

[Bug]: Camera opens after second attempt on Android #7721

Closed daniil777555 closed 1 month ago

daniil777555 commented 1 month ago

Capacitor Version

classpath 'com.google.gms:google-services:4.4.0' classpath 'com.android.tools.build:gradle:8.2.1' distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip

Capacitor dependencies "@capacitor/android": "^6.1.2", "@capacitor/app": "^6.0.1", "@capacitor/camera": "^6.0.2",

Other API Details

No response

Platforms Affected

Current Behavior

On newer versions of android camera opens after 2 attempts. I call Camera.getPhoto with option saveToGallery set to true. The the system bottom sheet appears and I choose Take a photo, then the sheet disappears and nothing, I have to click the button again to call Camera.getPhoto and again choose Take a photo. But, if I set saveToGallery to false, everything works as expected. Also worth mentioning that after these manipulations camera opens from the first attempt until I restart the app. I've tried disabling camera permissions and plugin doesn't ask any, I've tried manually request permissions but nothing pops up, I've tried manually enable permissions in settings and bug still presents. And one more thing, I've put console.log after await Camera.getPhoto and nothing appears in console on a first attempt when Camera didn't show off but on second my console.log has been fired.

I've been thinking maybe I should change versions for these things as Android studio suggests but I'm not sure whether to do it as Capacitor documentation says these versions should be set. classpath 'com.google.gms:google-services:4.4.0' classpath 'com.android.tools.build:gradle:8.2.1' distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip

Capacitor dependencies "@capacitor/android": "^6.1.2", "@capacitor/app": "^6.0.1", "@capacitor/camera": "^6.0.2",

Expected Behavior

Camera should open after first attempt.

Project Reproduction

I believe there is no need for such project but I can make it on request

Additional Information

No response

jcesarmobile commented 1 month ago

The plugins Camera plugin is located in the capacitor-plugins repository (https://github.com/ionic-team/capacitor-plugins), you should report the issue there.

Also make sure you provide a sample app that reproduces the problem.

ionitron-bot[bot] commented 1 week ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.