Open bmarsaud opened 1 month ago
The resultCode
received by the activity result is indeed Activity.RESULT_CANCELED
, but the file at the imageUri
location contains well the photo taken.
~I also noticed that the intent
is null
, which is not the case when you only have one photo taking app installed. We can descrimine on that to handle this case.~ The intent
is always null
when it has been cancelled.
FYI, the intent being cancelled in the first place seems to be due to the AndroidLaunchMode
(https://medium.com/mindorks/android-launch-mode-787d28952959) being set to singleInstance
.
Using singleTask
instead fix the issue, the intent is no longer considered as cancelled and everything is working properly.
Bug Report
Problem
What is expected to happen?
The image capture request should resolve successfully while another photo taking application is installed on the device.
What does actually happen?
The image capture request is considered as cancelled (Error code 3) while the user has successfully taken the photo.
Information
To reproduce, you need to have another photo taking application installed (Like Professional HD Camera for instance) so that Android is showing you an intent to chose the application to use. You don't even need to use this other application, the problem occurs whether you use the default camera app or not.
The problem occurs on Android 8, 9 and 10. It does not occur on Android 11, 12 and 13.
I don't know for versions prior to 8.
This is a duplicate of #139, but as it's tagged as Invalid, I'm recreating the issue here with more information.
Command or Code
Nothing special here, a simple :
will do.
Environment, Platform, Device
Devices : Android SDK Emulator and various physical devices on Android 8, 9, 10 Dev env OS : Ubuntu 22.04 LTS
Version information
Cordova : 12.0.0 Cordova Platforms : Android 12.0.1, iOS 6.3.0
Checklist