I tried to turn on and turn off the flash when I use the camera with Barcode Detection in Google Play services, in several problems they say that the solution is setFashMode method of the class CameraSource but I did not find this method
cameraSource = CameraSource.Builder(mActivity,detector).setRequestedPreviewSize(1024,900) .setRequestedFps(50f).setAutoFocusEnabled(true).build()