I am facing this issue, it occurs rarely but once it occurs user cannot go forward as there is no workaround that I am able to do.
While the user clicks on capture the camera is working in the background, but still i am getting camera is closed error.
Device info :
Brand : Nokia
Android version : 10
Model : Nokia 6.1 Plus
This is the code I am using to capture image
imageCapture.takePicture(outputFileOptions, ContextCompat.getMainExecutor(getContext()),
new ImageCapture.OnImageSavedCallback() {
@Override
public void onImageSaved(ImageCapture.OutputFileResults outputFileResults) {
imagePath = FileProvider
.getUriForFile(getContext(), getContext().getPackageName() + ".provider", imageFile);
checkImageOrientation();
}
@Override
public void onError(ImageCaptureException error) {
// Error is : **Camera is closed.**
}
});