Camera won't turn on

38 views
Skip to first unread message
Assigned to trevor...@google.com by me

張家康

unread,
Nov 2, 2022, 10:34:21 PM11/2/22
to Android CameraX Discussion Group
Hi Team,
I have Rk3288 Development Board, I use CameraX Development camera application,found me switching the camera on and off multiple times,there is a chance that the camera won't turn on,Can only force close the app or reboot devices,I want to ask what is the problem?
Does cameraX have a callback to know the status of the camera response?

Thanks

Trevor McGuire

unread,
Nov 3, 2022, 7:24:46 PM11/3/22
to Android CameraX Discussion Group, ld9...@gmail.com
Hello,
That device is not one we have tested, but I can try to help. Some implementations of the camera service and camera HAL may have bugs which can cause the camera to become non-responsive and require a device reboot. This is more prevalent on older API levels, especially as you get into the API 21-23 range.

That said, CameraX will retry connecting to the camera and will eventually emit an error if it cannot. The error is part of the CameraState API, which can be observed like so:
Camera camera = processCameraProvider.bindToLifecycle(...);
camera.getCameraInfo().getCameraState().observe(lifecycleOwner, (state) -> {
   // Check state for error
   if (state.getError() != null) {
       // Handle error
   }
});


The list of possible errors, and whether they're recoverable can be found here: https://developer.android.com/reference/androidx/camera/core/CameraState.StateError

Please let me know if that helps.

Reply all
Reply to author
Forward
0 new messages