-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: camera opens after second attempt on Android with using Camera.getPhoto with saveToGallery set to true #2210
Comments
This issue needs more information before it can be addressed. Please see the Contributing Guide for how to create a Sample App. Thanks! |
Repository with reproduction https://github.com/daniil777555/capacitor-camera-reproduction Camera won't open on a first attempt to take a photo. It has been tested on Android APIs 33,34,35 This bug is noticed when saveToGallery is set to true but if it's false then it works Also additional bug, that Camera.requestPermissions() doesn't request permissions on Android More detailed explanation, after initial loading or restarting the app, clicking button you see a prompt to choose whether to take a photo or choose from gallery, but after choosing to take a photo, camera won't open you must click the button again and choose Take a photo again, then camera will open. After you did it once, camera will open on a first attempt until you restart the app. |
I have exactly the same problem on new versions of Android. There is also a problem with the permission request, it does not appear. |
Facing the exact same issue here. Did someone find a solution? |
Nope, waiting for Capacitor team to reply :) |
This issue has been labeled as |
@daniil777555 we just released a new version of @capacitor/camera with the fix. Can you update and test? |
Sure, thanks, I will let you know as soon as I update and test |
Hi again, |
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 the plugin, please create a new issue and ensure the template is fully filled out. |
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 tried to update these things as Android studio suggests despite Capacitor documentation says these versions should be set but it didn't help.
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",
The text was updated successfully, but these errors were encountered: