Reputation: 454
I'm creating an app that uses the camera and flashlight on android, the problem is that I need to turn flashlight on while the camera is running, I looked at some of the answers but none of them could help me, please help me?!
How to turn on front flash light programmatically in Android? this answer don't work for me, because in this answer is to turn on front flashlight, I need to turn the back flash on while the camera is running
Upvotes: 0
Views: 1173
Reputation: 617
This is how:
previewRequestBuilder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_TORCH)
captureSession.setRepeatingRequest(previewRequestBuilder.build(), cameraCaptureCallback, cameraBackgroundHandler)
So, firstly you should set up FLASH_MODE
request, and then you update the current session with that request.
Upvotes: 1