You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on a Google Pixel 7a running Android 14, a file picker is shown instead of the camera. However, on a Samsung A52 running Android 14 the camera is shown as expected.
Expected Behavior
I expect the camera to show on all devices, including the Google Pixel.
if (takePictureIntent.resolveActivity(bridge.getActivity().getPackageManager()) == null) {
returnfalse;
}
The resolveActivity method returns null on the Google Pixel, but not on the Samsung.
If I remove this if statement entirely, the camera opens as expected on the Google Pixel. Same with the showVideoCapturePicker method. So it appears that the resolveActivity method is returning a false negative on the Google Pixel.
What about removing the if and expanding the try block to encompass all of the method's statements? Something like:
Capacitor Version
馃拪 Capacitor Doctor 馃拪
Latest Dependencies:
@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0
Installed Dependencies:
@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0
[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣
Other API Details
No response
Platforms Affected
Current Behavior
If I select an input like
on a Google Pixel 7a running Android 14, a file picker is shown instead of the camera. However, on a Samsung A52 running Android 14 the camera is shown as expected.
Expected Behavior
I expect the camera to show on all devices, including the Google Pixel.
Project Reproduction
https://gist.github.com/diachedelic/3970e9617d26d4629b6e38887a830555
Additional Information
I believe I have found the problem. It is in BridgeWebChromeClient.java.
This method is responsible for showing the camera, falling back to a file picker if the camera fails to open:
capacitor/android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
Lines 345 to 361 in 5b2ab7c
I can confirm that the
shown
variable is set totrue
on my Samsung, butfalse
on my Google Pixel. Thus the file picker opens on the Google Pixel.Digging deeper, the
showImageCapturePicker
method appears to be exiting early after failing to resolve the intent's activity:capacitor/android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
Lines 364 to 368 in 5b2ab7c
The
resolveActivity
method returnsnull
on the Google Pixel, but not on the Samsung.If I remove this
if
statement entirely, the camera opens as expected on the Google Pixel. Same with theshowVideoCapturePicker
method. So it appears that theresolveActivity
method is returning a false negative on the Google Pixel.What about removing the
if
and expanding thetry
block to encompass all of the method's statements? Something like:The text was updated successfully, but these errors were encountered: