ImageCapture.OnImageSavedCallback Callback Behavior

Skip to first unread message

Subhadip Nath

Apr 30, 2024, 2:17:38 AMApr 30
to Android CameraX Discussion Group

Hi there,

I'm encountering an unexpected behavior with the ImageCapture.OnImageSavedCallback. Both the onError and onImageSaved callbacks are being invoked.

  • onError Callback: This callback is triggered frequently with the error code ImageCapture.ERROR_CAMERA_CLOSED.
  • Black Images: In some instances, particularly on Motorola devices, a black image is captured despite receiving the onImageSaved callback.

Charcoal Chen

May 1, 2024, 11:52:10 PMMay 1
to Subhadip Nath, Android CameraX Discussion Group

Thanks for reporting the issue.

About the onError and onImageSaved callbacks, I guess it might be the case as below:
1. Your app allows end users to press the capture button multiple times even if the previous still capture is not completed yet. Then, press the capture button many times in the first step.
2. Press the device HOME key to move the app to background
3. One or two onImageSaved callbacks might be received for the capture requests that can still be processed completely. Some ImageCapture.ERROR_CAMERA_CLOSED callbacks will come for the remaining uncompleted capture requests.

If it is the above case, it should be the expected behavior. If it is not, please provide more info about the reproduce steps for the issue.

About the black images issue, it will need more info to investigate whether it is device specific issue or CameraX library issue. Could you create an issue here and provide some device names that the issue happens on? Thanks.

You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Subhadip Nath

May 2, 2024, 11:25:09 AMMay 2
to Android CameraX Discussion Group,, Android CameraX Discussion Group

Hi Charco,

Thanks again for your response on the callback issue. Your explanation really helped me understand and resolve it.

In regards to the black image issue, I've created a separate issue here.


Reply all
Reply to author
0 new messages